デフォルトでない場所が必要なら、configPath入力でパスを上書きしてください。
スキーマ
# .github/resource-translator.ymlsourceLocale: en
# Provider config can be nested. Keep secrets in workflow inputs; use repo# config for non-secret defaults like region, model, formality, or category.provider: azure: categoryId: my-custom-translator-category apiVersion: "3.0" allowFallback: true
toLocales: - fr - de - esinclude: - "src/**/*.en.json" - "apps/**/*.en.resx"exclude: - "**/__tests__/**"glossary: Acme: Contoso Octocat: Octocat # keep brand names verbatim
# Translator request shape — most users can ignore these.textType: plain # plain | htmlprofanityAction: NoAction # NoAction | Marked | DeletedprofanityMarker: Asterisk # Asterisk | Tag (only when profanityAction == Marked)
# Resilience — Translator returns 429 under load. Defaults are usually# fine; tune only if your runs are large enough to hit them.maxRetries: 5retryBackoffMs: 30000 # cap on any single backoff sleep (ms)
# Placeholder protection. ON by default — wraps tokens like {{name}},# {0}, %s, ${var} into sentinels before translation and restores them# on the way back. Set false only when source intentionally contains# placeholder-shaped literals.protectPlaceholders: truecustomPlaceholderPatterns: - "<<.+?>>" # any extra token syntax you use
# Per-key opt-out. Keys matching any glob are dropped from the request# and pass through with the source value preserved.noTranslatePatterns: - "errors.code.*" - "brands.*"フィールド参照
providerEither a provider string or a nested provider block (provider.azure, provider.aws, or provider.google). Prefer nested blocks for provider-specific settings; keep secrets in workflow inputs rather than committed config.
sourceLocale設定されていないとsourceLocale入力に戻されます。また、短い文字列が自動検出されないように、from=<locale>としてトランスレーターにも転送しています。
toLocales配列かカンマ区切られた文字列のいずれかです。
include / excludeグロブパターンは絶対パスおよびワークスペース相対パスと比較して評価されました。
glossary翻訳後の用語が上書きされます。単語境界を認識している(C++、.NETの扱い)。
categoryIdAzure Custom Translatorカテゴリ — あなたの業界/ドメインのノブ(法務、医療、マーケティングのトーンなど)。?category=...として送信。
textTypeデフォルトはplainです。リソース値に実際のHTMLの断片が含まれている場合のみhtml使ってください。
profanityAction翻訳されたアウトプットにおける罵り言葉の扱い方。
profanityMarkerprofanityActionが"Marked"時だけ意味がある。
allowFallbackfalseに設定して、categoryIdがターゲットのロケーションにデプロイしていないときに翻訳に失敗するように設定してください。一般的なモデルに戻るのではなく。
apiVersionトランスレーターREST APIバージョン。デフォルトは3.0です。
awsFormalityAWS Translate formality setting for supported target languages.
awsBrevitySet to true to enable AWS Translate brevity mode for supported language pairs.
awsTerminologyNames / awsParallelDataNamesAWS Translate custom terminology and parallel data resource names. Either an array or comma-separated string.
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.
maxRetries一時的なHTTP応答に対する最大リトライ試行数(408, 425, 429, 500, 502, 503, 504)。デフォルトは5です。リクエストあたりの総HTTP呼び出しは1 + maxRetriesです。
retryBackoffMs単一のバックオフ睡眠にはキャップ(ms)を設定してください。デフォルトは30000です。アズールのRetry-Afterの頭部は、存在するときに正確に尊重されます。それ以外の場合はジッター指数的バックオフが使用され、この値に上限を設けます。
protectPlaceholdersデフォルトはtrueです。オンの場合、{{name}}、${var}、{0}、{0:N2}、%s、%1$s、HTMLなどのトークンは、翻訳前にセンチネルトークンに置き換えられ、変換後に復元されます。ソースが意図的にプレースホルダー型リテラルを含む場合にのみ無効化してください。
customPlaceholderPatternsデフォルトのプレースホルダーセットに追加された正則表現パターン(区切り符なし)など、カスタムトークン構文用の<<.+?>>など。無効な正言式は無視されます。
noTranslatePatternsグロブパターンはパーサーレベルのキー(JSON点線パス、RESX name、PO msgid、XLIFFユニットid、INI/restextキー)とマッチングされました。対応する鍵はリクエストから削除され、元の値を保持したままパススルーされます。
changeDetectionDefaults to smart. Uses the committed state manifest to translate only changed or missing parser keys. Set to disabled or false to preserve the legacy always-translate behavior.
statePathPath to the deterministic smart change-detection state manifest. Defaults to .github/resource-translator-state.json.
ロード順序
- このアクションはワークフローからの明示的な入力を読み込みます。
configPathからYAML設定を読み込みます。- 共有フィールドごとに入力が勝ちます。それ以外の場合はYAML値を使用します。
- 統合された値は検証されます。無効な列挙(例:
profanityAction: Mask)は、クリアメッセージとともにアクションが速く失敗します。
トーンと産業、つまり簡単に言えば
Azure AI Translator v3 APIには単一のトーンノブはありません。2つの設定を組み合わせると、ほとんど同じコントロールが得られます:
- 産業/ドメイン:
categoryIdを使って、自分のコーパスで訓練したAzureのCustom Translatorカテゴリ(法務、技術、医療、マーケティングなど)を指し示してください。これはトーン、ブランドボイス、語彙の最も強力なレバーです。 - 表面のテキスト: 用語集を使ってブランド名や商品用語をそのまま固定し、若年層向けのローカリゼーションを狙う際には
profanityActionで下品な言葉を消すのに使う。