g4/translate
最新稳定版本:1.0.0
Composer 安装命令:
composer require g4/translate
包简介
g4 i18n php library
关键字:
README 文档
README
- Configuration of the gettext extension
- Utlity tool to generate .mo files
- Utility tool for extracting template strings
Install
Using Composer and Packagist
composer require g4/translate
Resources
- Twig The i18n Extension http://twig.sensiolabs.org/doc/extensions/i18n.html
- PHP gettext extension http://fr.php.net/manual/en/function.gettext.php
Requirements
- "twig/twig" https://packagist.org/packages/twig/twig
- "twig/extensions" https://packagist.org/packages/twig/extensions
Usage
Set locale early in the program before rendering any internationalized template.
use G4\Translate\Locale\Locale; use G4\Translate\Locale\Options; $options = new Options(); $options ->setDomain('myDomain') ->setLocale('en_US') ->setPath('/path/to/locale/files'); (new Locale($options))->set();
Command line interface
Convert .po files to .mo
./vendor/bin/translate --path /path/to/locale/files
where --path is path to your locale folder
Extract template strings
./vendor/bin/translate-extract -t /path/to/templates -w /path/to/tmp -g /path/to/locale/files -d myDomain
where:
- -t is path to folder that contains templates
- -w is path to temp folder
- -g is path to folder where myDomain.po file with strings will be generated
- -d domain name
Development
Install dependencies
$ make install
Run tests
$ make test
License
(The MIT License) see LICENSE file for details...
统计信息
- 总下载量: 30.07k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-24