关于 YAML 模式和加载顺序,请参见配置。
所需输入
sourceLocale用于查找资源文件(如**/*.en.resx)的源位置(例如 en)。也转发给了from=<locale>。
提供者选择与资质
每次使用时选择一位provider。只需提供所选供应商的资质——完整设置请参见 输入与输出 指南。
provider翻译提供商:azure(默认)、aws或google。每个行动呼叫只使用一位提供者。
subscriptionKeyAzure AI Translator 订阅密钥。azure必修。通过secrets。
endpointAzure Translator endpoint URL,例如 https://api.cognitive.microsofttranslator.com/.azure必修。
awsAccessKeyIdAWS 访问密钥 ID。可选——awsSecretAccessKey省略使用AWS默认凭证链/OIDC。通过secrets。
awsSecretAccessKeyAWS 秘密访问密钥。必须与awsAccessKeyId一起提供。通过secrets。
awsSessionToken可选的AWS会话令牌用于临时凭证。通过secrets。
awsRegion翻译服务的AWS区域(例如us-east-1)。除非AWS_REGION设定在环境中,否则aws是必需的。
awsFormalityAWS Translate formality setting: FORMAL or INFORMAL.
awsBrevityWhen true, enables AWS Translate brevity mode for supported language pairs.
awsTerminologyNamesAWS Translate custom terminology resource names. Accepts a JSON array or comma-separated values.
awsParallelDataNamesAWS Translate parallel data resource names. Accepts a JSON array or comma-separated values.
googleApiKeyGoogle Cloud API 密钥。请提供这份手术室googleCredentials给google。通过secrets。
googleCredentialsGoogle Cloud 服务账户密钥作为 JSON 字符串。请提供这份手术室googleApiKey给google。通过secrets。
googleProjectId可选的 Google Cloud 项目 ID。通常通过服务账户凭证推断出来。
googleModelGoogle Cloud Translation model, e.g. nmt or base.
googleApiEndpointOptional Google Cloud Translation API endpoint override.
googleAutoRetryOptional Google Cloud Translation automatic retry toggle. Leave unset to use the Google client default.
常见的可选输入
region翻译资源区域(全局资源省略)。
toLocales需要翻译的地点。接受 JSON 数组(["fr","de"])或逗号分隔值。
include新行分离球状图案;仅翻译匹配的文件。
exclude新行分离球状图案;跳过匹配文件(在include后应用)。
configPath相对于工作区根节点,路径指向 YAML 配置文件。
changeDetectionSmart change detection mode. smart translates only keys whose source value, target presence, state entry, or translation-affecting settings require it. Use disabled or false to send every eligible key on every run.
statePathPath to the compact deterministic smart change-detection state manifest. Defaults to .github/resource-translator-state.json; commit it so future runs can audit and reuse unchanged translations.
snapshotOnlyWhen true, create/update the smart change-detection manifest from existing source and target files without calling a translation provider or writing target resource files. Useful when bootstrapping statePath while a provider is unavailable.
dryRun在true时,运行翻译并发送摘要,但不要写文件。
failOnError当true时,意外错误会失败;false时,错误就是警告。
Azure Translator request inputs
这些直接映射到 Azure AI Translator v3 的查询参数,并应用到 Azure 提供者。textType 和 profanityAction 也映射到 AWS/Google,而 Google 存在相应的服务(详见提供者指南);其余的都是仅限Azure的。所有选择都是可选的;未设置时,翻译器默认值生效。
categoryIdAzure Custom Translator category — the industry/domain/tone knob.转发为?category=...。
textTypeplain或html。只有当资源值是真实的HTML片段时才使用html。
profanityActionNoAction、Marked或Deleted。控制翻译中脏话的出现。
profanityMarkerAsterisk或Tag。只有当profanityAction是Marked时才有意义的。
allowFallback当false时,如果你的categoryId没有针对目标区域的部署,翻译器会返回错误,而不是退回通用系统。
apiVersion翻译器REST API版本。
弹性与占位保护
这些输入控制了当翻译器限速你的请求时动作的表现,以及它如何保护像{{name}}或{0}这样的占位标记在翻译过程中不被破坏。
maxRetries瞬态HTTP响应的最大重试次数(408, 425, 429, 500, 502, 503, 504)。每个请求的HTTP调用总数为1 + maxRetries。
retryBackoffMs对任何一次退后睡眠进行毫秒级限制。该动作在Azure的Retry-After响应头存在时精确执行;否则则使用抖动指数退避,限制在此值。
protectPlaceholders当true(默认)时,{{name}}、${var}、{0}、{0:N2}、%s、%1$s和HTML实体等占位符在翻译前被替换为哨兵标记,翻译后恢复。只有当你的来源故意包含需要翻译的字面占位文字时,才禁用。
customPlaceholderPatterns将换行分隔的正则表达式(无分隔符)添加到默认占位符集中,例如用于自定义令牌语法的<<.+?>>。
noTranslatePatterns换行分离的球状模式与解析器级别键匹配(JSON点线路径、RESX name、PO msgid、XLIFF单元id、INI/restext键)。匹配的密钥会从翻译器请求中丢弃,并保留其源值通过。
输出
summary-title简短且适合公关标题的摘要,例如Machine-translated 320 files, a total of 5,418 translations。
summary-details适合公关机构或职位摘要的Markdown摘要。
has-new-translations'true'生成一个或多个新译本。