partnermarketing/translation-bundle
最新稳定版本:0.8.1
Composer 安装命令:
composer require partnermarketing/translation-bundle
包简介
A translation component supporting different translation adapters -- by default, OneSky.
README 文档
README
TranslationBundle is a translation component supporting supporting different translation adapters -- by default, OneSky.
The existing adapters are:
- OneSky
Workflow
When you're developing you should add all translation keys into a file under app/Resources/base-translations.
When you pull translations those will be placed in Symfony 2 standard directory for translations app/Resources/translations.
The directory structure should be similar to the one in base-translations directory, but all files will have
an extension to the name.
e.g.
base-translations/hello_world.yml
After translation will become:
translations/hello_world.en_GB.yml
translations/hello_world.pt_PT.yml
...
How to configure
in your parameters.yml
parameters: locale: en_GB # Symfony2 locale configuration partnermarketing_translation.base_language: %locale% partnermarketing_translation.supported_languages: [%locale%, pt_PT] partnermarketing_translation.one_sky.project_id: 123 partnermarketing_translation.one_sky.api_key: yourOneskyKey partnermarketing_translation.one_sky.api_secret: youroneskysecret
How to use
See documentation in Symfony 2.
$translator = $this->get('translator'); $translator->trans('your_key');
How to push translations
app/console partnermarketing:translations:push_base_translations
How to pull translations
This will pull all latest translations into app/Resources/translations.
If base language translations were changed their values will be updated in app/Resources/base-translations.
app/console partnermarketing:translations:pull_translations
How to run tests
Since phpunit is a dependency you can run tests using:
vendor/bin/phpunit
How to contribute
统计信息
- 总下载量: 2.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2014-12-08