panlatent / translator
dev-cli
2024-08-18 06:07 UTC
Requires
- php: >=8.2
- symfony/console: ^7.1
README
Translator 是一个命令行工具,可以提取 PHP 源代码和 Twig 模板中的消息字符串。它旨在与 Poedit 等工具配合使用,并支持 CraftCMS。
要求
- PHP 8.2 或更高版本
安装
composer global require panlatent/translator:cli
用法
在 Poedit 中添加自定义提取器。
./translator extract %F --output=%o
将配置添加到 config/app.php
文件中
'components' => [ 'i18n' => [ 'translations' => [ 'site' => [ 'class' => GettextMessageSource::class, 'sourceLanguage' => 'en-US', 'basePath' => '@translations', ], '*' => [ 'class' => GettextMessageSource::class, 'sourceLanguage' => 'en-US', 'basePath' => '@translations', ], ] ], ],
许可证
Translator 是开源软件,采用 MIT 许可证。