vanengers/prestashop-module-translation

v1.4 2024-01-04 15:54 UTC

This package is auto-updated.

Last update: 2024-09-04 17:36:04 UTC


README

从您的PrestaShop模块的PHP、Twig和Smarty文件中提取并使用DeepL进行翻译。将它们导出为Xlf文件,以便在模块安装时自动导入。使用PrestaShop的语言区域。

要求

您需要在您的composer.json中添加自定义仓库 "repositories": [ { "type": "git", "url": "https://github.com/PrestaShopCorp/module-translation-tool.git", "symlink": false } ]

安装

composer require --dev vanengers/prestashop-module-translation

使用方法

php vendor/bin/extract --extraction_dir=./path/to/ps_module --module_name=PS_MODULE --deepl_key=DEEPLAPIKEY --translate_to=de-DE,ru-RU,it-IT,es-ES,pl-PL --base_locale=en-GB

可选参数

--translations_config_file=./path/to/translations_config.json
上一次运行保存的translations.json文件。

--translations_xliff_dump_folder=./path/to/ps_module/translations
为PrestaShop生成的文件,这应该位于模块/translations文件夹中。

--deepl_key=DEEPLAPIKEY
一个有效的DeepL API密钥,有剩余的使用次数。

--formality=more
有关正式选项的说明,请参阅https://www.deepl.com/nl/docs-api/translate-text。此选项不适用于所有语言。

--extraction_types=php,twig,smarty
使用此选项仅提取特定文件类型。

备注

--translate_to=de-DE,ru-RU,it-IT,es-ES,pl-PL
DEEPL ISO代码所需的格式:ISO 3166-1,请参阅https://en.wikipedia.org/wiki/ISO_3166-1

在DeepL创建您的API密钥

https://www.deepl.com/nl/pro-api?cta=header-pro-api