hricer/sync-translations
最新稳定版本:0.4.0
Composer 安装命令:
composer require hricer/sync-translations
包简介
Synchronize all translation files.
README 文档
README
The command for synchronize all translation files according to one locale file. This will ensure that all translation files contain the same keys.
This allows the developer to manage only one language. Before deploy the application into production, the developer executes synchronization for other languages.
Usage
Imagine you made changes to the main locale file, e.g. messages.en.yaml:
common:
yes: Yes
+ no: No
actions:
close: Close
- send: Send
toast:
save: 'Successfully saved.'
Now you need synchronize all messages.*.yaml files by messages.en.yaml (add new or remove old lines). Type into the terminal:
$ php bin/console translation:sync en --domain=messages
| Options | Default | Description |
|---|---|---|
--domain |
* (all) |
The translation domain name to synchronize. |
--directory |
translations |
Directory with translation files. |
--format |
yaml |
Only YAML supported. |
--deepl |
null |
Optional DeepL API key for auto translation. |
The command will update all messages.*.yaml (exclude en).
For exmaple message.cs.yaml :
common:
yes: Ano
+ no: No
actions:
close: Zavřít
- send: Odeslat
toast:
save: 'Úspešně uloženo.'
You can use --deepl parameter for auto translate all new lines.
Install
Step 1: Download the package
$ composer require hricer/sync-translations --dev
Step 2: Regist the Bundle
// bundles.php return [ // ... Hricer\SyncTranslations\SyncTranslationsBundle::class => ['dev' => true], ];
Without Symfony Bundle system
Create a console application with translation:sync as its only command:
// bin/translation.php use Symfony\Component\Console\Application; use Hricer\SyncTranslations\Command\SyncTranslationCommand; (new Application('translation/sync')) ->add(new SyncTranslationCommand()) ->getApplication() ->setDefaultCommand('translation:sync', true) ->run();
统计信息
- 总下载量: 588
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-02-22