每次運行後打開一個拉取請求
- id: translate uses: IEvangelist/resource-translator@v3 with: sourceLocale: en subscriptionKey: ${{ secrets.TRANSLATOR_KEY }} endpoint: ${{ secrets.TRANSLATOR_ENDPOINT }} region: ${{ secrets.TRANSLATOR_REGION }}
- if: steps.translate.outputs.has-new-translations == 'true' uses: peter-evans/create-pull-request@v7 with: branch: machine-translation title: ${{ steps.translate.outputs.summary-title }} body: ${{ steps.translate.outputs.summary-details }} labels: localizationMonorepos:每個包嘅範圍翻譯
with: sourceLocale: en include: | apps/web/**/*.en.resx packages/shared/**/*.en.json exclude: | **/dist/** **/__tests__/**品牌名稱和產品術語詞彙表
將一個.github/resource-translator.yml放入儲存庫:
glossary: Acme: Contoso Octocat: Octocat ".NET": ".NET" "C++": "C++"詞彙表術語會應用之後翻譯,所以機器翻譯嘅輸出可以保留你偏好嘅品牌,即使模型將佢換成同義詞。
自訂翻譯器類別 (行業 / 領域)
with: sourceLocale: en subscriptionKey: ${{ secrets.TRANSLATOR_KEY }} endpoint: ${{ secrets.TRANSLATOR_ENDPOINT }} categoryId: 1234abcd-5678-90ef-... 在擷取行業詞彙和語氣(法律、醫療、市場營銷、內部工程等)的語料庫上訓練一個 Azure Custom Translator類別,並透過categoryId傳遞其 ID。 呢個係Azure提供嘅最強音調槓桿。
音調控制 + 嚴格後備
# .github/resource-translator.yml# Industry / domain — choose your tone via a Custom Translator categorycategoryId: legal-en
# Treat profanity strictly for content aimed at younger audiencesprofanityAction: MarkedprofanityMarker: Tag
# Fail the run rather than silently fall back to the general modelallowFallback: false 將自訂翻譯器categoryId與profanityAction和allowFallback: false結合,以強制執行一致的聲音,如果所選類別沒有針對其中一個目標地區設定的部署,工作流程就會失敗。
在開啟工作流程之前先進行試運行
with: dryRun: true failOnError: false 動作仍然會發出摘要輸出同步驟摘要,但唔會寫入任何檔案。 結合failOnError: false,將每個問題浮現出來,作為警告,同時迭代。