デフォルトでない場所が必要なら、configPath入力でパスを上書きしてください。
スキーマ
# .github/resource-translator.ymlsourceLocale: entoLocales: - fr - de - esinclude: - "src/**/*.en.json" - "apps/**/*.en.resx"exclude: - "**/__tests__/**"glossary: Acme: Contoso Octocat: Octocat # keep brand names verbatim
# Domain / industry — uses an Azure Custom Translator category trained on# your tone and vocabulary. Leave unset for the general model.categoryId: my-custom-translator-category
# Translator request shape — most users can ignore these.textType: plain # plain | htmlprofanityAction: NoAction # NoAction | Marked | DeletedprofanityMarker: Asterisk # Asterisk | Tag (only when profanityAction == Marked)allowFallback: true # false fails when the categoryId has no deployment
apiVersion: "3.0"
# 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.*"フィールド参照
| フィールド | 種類 | 注記 |
|---|---|---|
sourceLocale | string | 設定されていないとsourceLocale入力に戻されます。また、短い文字列が自動検出されないように、from=<locale>としてトランスレーターにも転送しています。 |
toLocales | string[] | 配列かカンマ区切られた文字列のいずれかです。 |
include / exclude | string[] | グロブパターンは絶対パスおよびワークスペース相対パスと比較して評価されました。 |
glossary | map<string,string> | 翻訳後の用語が上書きされます。単語境界を認識している(C++、.NETの扱い)。 |
categoryId | string | Azure Custom Translatorカテゴリ — あなたの業界/ドメインのノブ(法務、医療、マーケティングのトーンなど)。?category=...として送信。 |
textType | "plain" | "html" | デフォルトはplainです。リソース値に実際のHTMLの断片が含まれている場合のみhtml使ってください。 |
profanityAction | "NoAction" | "Marked" | "Deleted" | 翻訳されたアウトプットにおける罵り言葉の扱い方。 |
profanityMarker | "Asterisk" | "Tag" | profanityActionが"Marked"時だけ意味がある。 |
allowFallback | boolean | falseに設定して、categoryIdがターゲットのロケーションにデプロイしていないときに翻訳に失敗するように設定してください。一般的なモデルに戻るのではなく。 |
apiVersion | string | トランスレーターREST APIバージョン。デフォルトは3.0です。 |
maxRetries | integer | 一時的なHTTP応答に対する最大リトライ試行数(408, 425, 429, 500, 502, 503, 504)。デフォルトは5です。リクエストあたりの総HTTP呼び出しは1 + maxRetriesです。 |
retryBackoffMs | integer | 単一のバックオフ睡眠にはキャップ(ms)を設定してください。デフォルトは30000です。アズールのRetry-Afterの頭部は、存在するときに正確に尊重されます。それ以外の場合はジッター指数的バックオフが使用され、この値に上限を設けます。 |
protectPlaceholders | boolean | デフォルトはtrueです。オンの場合、{{name}}、${var}、{0}、{0:N2}、%s、%1$s、HTMLなどのトークンは、翻訳前にセンチネルトークンに置き換えられ、変換後に復元されます。ソースが意図的にプレースホルダー型リテラルを含む場合にのみ無効化してください。 |
customPlaceholderPatterns | string[] | デフォルトのプレースホルダーセットに追加された正則表現パターン(区切り符なし)など、カスタムトークン構文用の<<.+?>>など。無効な正言式は無視されます。 |
noTranslatePatterns | string[] | グロブパターンはパーサーレベルのキー(JSON点線パス、RESX name、PO msgid、XLIFFユニットid、INI/restextキー)とマッチングされました。対応する鍵はリクエストから削除され、元の値を保持したままパススルーされます。 |
ロード順序
- このアクションはワークフローからの明示的な入力を読み込みます。
-
configPathからYAML設定を読み込みます。 - 共有フィールドごとに入力が勝ちます。それ以外の場合はYAML値を使用します。
- 統合された値は検証されます。無効な列挙(例:
profanityAction: Mask)は、クリアメッセージとともにアクションが速く失敗します。
トーンと産業、つまり簡単に言えば
Azure AI Translator v3 APIには単一のトーンノブはありません。2つの設定を組み合わせると、ほとんど同じコントロールが得られます:
- 産業/ドメイン:
categoryIdを使って、自分のコーパスで訓練したAzureのCustom Translatorカテゴリ(法務、技術、医療、マーケティングなど)を指し示してください。これはトーン、ブランドボイス、語彙の最も強力なレバーです。 - 表面のテキスト: 用語集を使ってブランド名や商品用語をそのまま固定し、若年層向けのローカリゼーションを狙う際には
profanityActionで下品な言葉を消すのに使う。