gettext / js-scanner
Javascript scanner for gettext
Installs: 45 988
Dependents: 3
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: ^7.2|^8.0
- gettext/gettext: ^5.5.0
- mck89/peast: ^1.9
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.15
- oscarotero/php-cs-fixer-config: ^1.0
- phpunit/phpunit: ^8.0
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2024-12-15 03:27:58 UTC
README
Created by Oscar Otero http://oscarotero.com oom@oscarotero.com (MIT License)
Javascript code scanner to use with gettext/gettext
Installation
composer require gettext/js-scanner
Usage example
use Gettext\Scanner\JsScanner; use Gettext\Generator\PoGenerator; use Gettext\Translations; //Create a new scanner, adding a translation for each domain we want to get: $jsScanner = new JsScanner( Translations::create('domain1'), Translations::create('domain2'), Translations::create('domain3') ); //Scan files foreach (glob('*.js') as $file) { $jsScanner->scanFile($file); } //Save the translations in .po files $generator = new PoGenerator(); foreach ($jsScanner->getTranslations() as $translations) { $domain = $translations->getDomain(); $generator->generateFile($translations, "locales/{$domain}.po"); }
Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details.
The MIT License (MIT). Please see LICENSE for more information.