Files
2026-09-15 10:35:56 +08:00

155 lines
11 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="esun" translate="label" sortOrder="300">
<label>Esun</label>
</tab>
<section id="esun_multilocale_translation" translate="label" type="text" sortOrder="920"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Multi-Locale Translation</label>
<tab>esun</tab>
<resource>Esun_MultiLocaleTranslation::config</resource>
<group id="general" translate="label" type="text" sortOrder="5"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>General</label>
<field id="default_provider" translate="label comment" type="select" sortOrder="10"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Default Translation Provider</label>
<comment>The popup selects this provider when it is enabled.</comment>
<source_model>Esun\MultiLocaleTranslation\Model\Config\Source\TranslationProvider</source_model>
</field>
<field id="default_source_language" translate="label comment" type="text" sortOrder="20"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Default Scope Source Language</label>
<comment>Language code for Magento default values, normally en.</comment>
</field>
<field id="skipped_fields" translate="label comment" type="multiselect" sortOrder="30"
showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
<label>Skipped Fields</label>
<comment>Selected fields are excluded from popup and batch translation. Leave empty to translate all currently supported fields.</comment>
<source_model>Esun\MultiLocaleTranslation\Model\Config\Source\SkippedFields</source_model>
</field>
</group>
<group id="deepl" translate="label" type="text" sortOrder="10"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>DeepL Translation API</label>
<comment><![CDATA[
<div class="message message-notice">
<strong>如何创建 DeepL API Key:</strong>
<ol>
<li>打开 <a href="https://www.deepl.com/pro-api" target="_blank" rel="noopener noreferrer">DeepL API</a>,注册 API Free 或 API Pro 套餐。</li>
<li>登录 DeepL 账号,在“API Keys”页面创建并复制 Auth Key。</li>
<li>API Free 选择 <code>api-free.deepl.com</code>;API Pro 选择 <code>api.deepl.com</code>。</li>
<li>把 Key 填入下面的 API Key,设置 Enable 为 Yes 并保存。</li>
</ol>
<p><strong>安全提醒:</strong>API Key 只会加密保存在 Magento 后台,不会发送到浏览器。Free Key 通常以 <code>:fx</code> 结尾。</p>
</div>
]]></comment>
<field id="enabled" translate="label comment" type="select" sortOrder="10"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Enable</label>
<comment>Enable DeepL automatic translation in the translation popup.</comment>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="api_url" translate="label comment" type="select" sortOrder="20"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>API URL</label>
<comment>Select the endpoint matching your DeepL API Free or API Pro account.</comment>
<source_model>Esun\MultiLocaleTranslation\Model\Config\Source\DeepLApiUrl</source_model>
</field>
<field id="auth_key" translate="label comment" type="obscure" sortOrder="30"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>API Key</label>
<comment>Get the DeepL API Key from your DeepL account and enter it here.</comment>
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
</field>
<field id="formality" translate="label comment" type="select" sortOrder="40"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Formality</label>
<comment>Prefer a formal or informal style when the target language supports it.</comment>
<source_model>Esun\MultiLocaleTranslation\Model\Config\Source\DeepLFormality</source_model>
</field>
<field id="timeout" translate="label comment" type="text" sortOrder="50"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Request Timeout (seconds)</label>
<comment>Allowed range: 5–120 seconds.</comment>
<validate>validate-number validate-greater-than-zero</validate>
</field>
</group>
<group id="google" translate="label" type="text" sortOrder="20"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Google Cloud Translation</label>
<comment><![CDATA[
<div class="message message-notice">
<strong>如何创建 Google Cloud Translation V3 服务账号:</strong>
<ol>
<li>登录 <a href="https://console.cloud.google.com/projectcreate" target="_blank" rel="noopener noreferrer">Google Cloud Console</a>,创建或选择一个项目。</li>
<li>为项目绑定 Billing 结算账号。Google Cloud Translation 是计费服务。</li>
<li>打开 <a href="https://console.cloud.google.com/apis/library/translate.googleapis.com" target="_blank" rel="noopener noreferrer">Cloud Translation API</a>,点击“启用”。</li>
<li>进入 <a href="https://console.cloud.google.com/iam-admin/serviceaccounts" target="_blank" rel="noopener noreferrer">IAM 和管理 → 服务账号</a>,创建服务账号。</li>
<li>为服务账号分配 <strong>Cloud Translation API User</strong> 角色(<code>roles/cloudtranslate.user</code>)。</li>
<li>打开该服务账号的“密钥”,选择“添加密钥 → 创建新密钥 → JSON”,下载 JSON 文件。</li>
<li>把 JSON 文件上传到下面的 <strong>Service Account JSON</strong>,设置 Enable 为 Yes,然后保存配置。</li>
</ol>
<p><strong>安全提醒:</strong>JSON 文件包含私钥,请勿通过聊天、邮件或公共网盘发送;如果泄露,请立即在 Google Cloud 删除该密钥并重新创建。</p>
<p>普通翻译请选择 Location = <code>global</code>。只有使用 Google Glossary 时才选择 <code>us-central1</code> 并填写 Glossary ID。</p>
</div>
]]></comment>
<field id="enabled" translate="label comment" type="select" sortOrder="10"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Enable</label>
<comment>Uses Google Cloud Translation Advanced v3 (NMT / Glossary).</comment>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="credentials_file" translate="label comment" type="file" sortOrder="20"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Service Account JSON</label>
<comment>Upload a Google service account JSON key. It is validated and stored privately under var/, never pub/media.</comment>
<backend_model>Esun\MultiLocaleTranslation\Model\Config\Backend\ServiceAccountFile</backend_model>
<upload_dir config="system/filesystem/var">esun/multilocale_translation/google</upload_dir>
</field>
<field id="location" translate="label comment" type="select" sortOrder="30"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Location</label>
<comment>Use global normally. Google Glossary currently requires us-central1.</comment>
<source_model>Esun\MultiLocaleTranslation\Model\Config\Source\GoogleLocation</source_model>
</field>
<field id="glossary_id" translate="label comment" type="text" sortOrder="40"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Glossary ID (optional)</label>
<comment>Enter only the existing Google Glossary ID. When set, Location must be us-central1.</comment>
</field>
<field id="glossary_ignore_case" translate="label comment" type="select" sortOrder="50"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Glossary Ignore Case</label>
<comment>Apply glossary terms without case sensitivity.</comment>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="timeout" translate="label comment" type="text" sortOrder="60"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Request Timeout (seconds)</label>
<comment>Allowed range: 5–120 seconds.</comment>
<validate>validate-number validate-greater-than-zero</validate>
</field>
</group>
<group id="queue" translate="label" type="text" sortOrder="30"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Translation Queue</label>
<field id="tasks_per_run" translate="label comment" type="text" sortOrder="10"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Tasks Per Run</label>
<comment>Maximum tasks processed each minute. Allowed range: 1–50.</comment>
<validate>validate-digits validate-greater-than-zero</validate>
</field>
<field id="time_limit" translate="label comment" type="text" sortOrder="20"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Time Limit (seconds)</label>
<comment>Stops claiming new tasks after this time. The current task is allowed to finish. Allowed range: 10–300 seconds.</comment>
<validate>validate-digits validate-greater-than-zero</validate>
</field>
</group>
</section>
</system>
</config>