voda / gettext-extractor
tool for extracting gettext messages
Installs: 31 842
Dependents: 1
Suggesters: 0
Security: 0
Stars: 22
Watchers: 3
Forks: 19
Open Issues: 6
Requires
- php: >=7.2.0
- latte/latte: ^2.5
- nette/utils: ^3.0
- nikic/php-parser: ^4.2
Requires (Dev)
- phpstan/phpstan: ^0.11.5
- phpstan/phpstan-phpunit: ^0.11.0
- phpstan/phpstan-strict-rules: ^0.11.0
- phpunit/phpunit: ^8
README
Tool for extracting gettext phrases from PHP files and Latte templates. Output is generated as a .pot file.
Installation
To install gettext-extractor install it with composer:
$ composer require --dev voda/gettext-extractor
Alternatively you can download a standalone PHAR file from releases page.
Usage
./vendor/bin/gettext-extractor [options]
Options:
-h display this help and exit
-oFILE output file, default output is stdout
-lFILE log file, default is stderr
-fFILE file to extract, can be specified several times
-kFUNCTION add FUNCTION to filters, format is:
FILTER:FUNCTION_NAME:SINGULAR,PLURAL,CONTEXT
default FILTERs are PHP and Latte
for SINGULAR, PLURAL and CONTEXT '0' means not set
can be specified several times
-mKEY:VALUE set meta header
e.g.: ./vendor/bin/gettext-extractor -o outup/file.pot -f files/to/extract/
Supported file types
- .php
- .latte (Nette Latte templates)
License
GettextExtractor is licensed under the New BSD License.
Based on code from Karel Klíma.