每次运行后,开启拉取请求
- 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传递识别。 此为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,迭代时每问题皆显警示。