rauwebieten/craft-translations-extractor
最新稳定版本:1.0.2
Composer 安装命令:
composer require rauwebieten/craft-translations-extractor
包简介
Craft CMS Translations Extractor
README 文档
README
WORK IN PROGRESS, USE AT OWN RISK
Requirements
This plugin requires Craft CMS 3.5 later.
Installation
composer require rauwebieten/craft-translations-extractor
Usage
php craft translations-extractor/index
This command will search for translations strings in your templates folder. This command uses a regular expression to find all translation strings, it will find following translation strings:
<p> {# translation with t filter #} {{ "Hello world"|t }} {# translation with translate filter #} {{ "Hello craft"|translate }} {# translation with single quotes #} {{ 'Hello template'|t }} {# translation with single/double quotes #} {{ 'This is a "quoted string"'|t }} {{ "This is another \"quoted string\""|t }} {{ 'This too is a \'quoted string\''|t|raw }} </p>
Foreach defined language in your project it will create a translation file.
- Translation string that are not in use anymore, are removed from the translation file
- Existing translations strings are merge with the newly found translations strings
translations/en/site-extracted.php
Do whatever you like with this file. For example, include it in the main translation file. This way you can still use a site.php file with your custom translation strings.
// translations/en/site.php <?php return array_merge(include __DIR__ .'site-extracted.php',[ 'other-translation-strings' => 'blah blah' ]);
Not supported.
This plugin is a work in progress. Use at own risk.
This plugin cannot:
- detect translation strings with parameters, like
"{num} pages"(params={num:3}) - detect translation strings with other namespaces, like
"hello"|t('plugin-handle')
Roadmap
- resolve issues as mentioned above
- use a translation API
- Craft 4 support
统计信息
- 总下载量: 58
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-05