Skip to content

Commit f143c19

Browse files
authored
Added readme (#15)
1 parent e8d2f8c commit f143c19

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

Readme.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Translation extractor
2+
3+
[![Latest Version](https://img.shields.io/github/release/php-translation/extractor.svg?style=flat-square)](https://github.com/php-translation/extractor/releases)
4+
[![Build Status](https://img.shields.io/travis/php-translation/extractor.svg?style=flat-square)](https://travis-ci.org/php-translation/extractor)
5+
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-translation/extractor.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-translation/extractor)
6+
[![Quality Score](https://img.shields.io/scrutinizer/g/php-translation/extractor.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-translation/extractor)
7+
[![Total Downloads](https://img.shields.io/packagist/dt/php-translation/extractor.svg?style=flat-square)](https://packagist.org/packages/php-translation/extractor)
8+
9+
**Extract translation messages from source code**
10+
11+
12+
## Install
13+
14+
Via Composer
15+
16+
``` bash
17+
$ composer require php-translation/extractor
18+
```
19+
20+
## Usage
21+
22+
```php
23+
$extractor = new Extractor();
24+
25+
// Create extractor for PHP files
26+
$fileExtractor = new PHPFileExtractor()
27+
28+
// Add visitors
29+
$fileExtractor->addVisitor(new ContainerAwareTrans());
30+
$fileExtractor->addVisitor(new ContainerAwareTransChoice());
31+
$fileExtractor->addVisitor(new FlashMessage());
32+
$fileExtractor->addVisitor(new FormTypeChoices());
33+
34+
// Add the file extractor to Extactor
35+
$extractor->addFileExtractor($this->getPHPFileExtractor());
36+
37+
// Define where the source code is
38+
$finder = new Finder();
39+
$finder->in('/foo/bar');
40+
41+
//Start extractring files
42+
$sourceCollection = $extractor->extract($finder);
43+
```

0 commit comments

Comments
 (0)