gettext/php-scanner
最新稳定版本:v2.0.1
Composer 安装命令:
composer require gettext/php-scanner
包简介
PHP scanner for gettext
README 文档
README
Created by Oscar Otero http://oscarotero.com oom@oscarotero.com (MIT License)
PHP code scanner to use with gettext/gettext
Installation
composer require gettext/php-scanner
Usage example
use Gettext\Scanner\PhpScanner; use Gettext\Generator\PoGenerator; use Gettext\Translations; //Create a new scanner, adding a translation for each domain we want to get: $phpScanner = new PhpScanner( Translations::create('domain1'), Translations::create('domain2'), Translations::create('domain3') ); //Set a default domain, so any translations with no domain specified, will be added to that domain $phpScanner->setDefaultDomain('domain1'); //Extract all comments starting with 'i18n:' and 'Translators:' $phpScanner->extractCommentsStartingWith('i18n:', 'Translators:'); //Scan files foreach (glob('*.php') as $file) { $phpScanner->scanFile($file); } //Save the translations in .po files $generator = new PoGenerator(); foreach ($phpScanner->getTranslations() as $domain => $translations) { $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.
统计信息
- 总下载量: 429.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 15
- 点击次数: 1
- 依赖项目数: 12
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-10-30