File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 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+ ```
You can’t perform that action at this time.
0 commit comments