每次執行完開一個拉取請求
- 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,喺迭代期間將每個問題都當作警告。