請參閱配置 YAML 架構與載入順序。
所需輸入
sourceLocale來源位置(例如 en)用於尋找資源檔案,如 **/*.en.resx。也轉寄給醫療提供者,作為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。
awsRegionAWS 區域用於翻譯服務(例如 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.
dryRuntrue時,執行翻譯並輸出摘要,但不要寫入檔案。
failOnError當 true 時,意外錯誤會失敗;當false時,錯誤就是警告。
Azure Translator request inputs
這些參數直接映射到 Azure AI Translator v3 的查詢參數,並套用到 Azure 供應商。textType 與 profanityAction 也映射至 AWS/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 版本。
韌性與佔位符保護
這些輸入控制 Translator 限制請求時動作的行為,以及如何保護像 {{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'產生一個或多個新譯本。