Step 1: Muab Azure AI Translator resource
Tsim Azure AI Tus Neeg Txhais Lus cov peev txheej hauv Azure portal, tom qab ntawd khaws cov hauv qab no raws li GitHub repository secrets kom lub workflow tuaj yeem nyeem lawv:
-
TRANSLATOR_KEY— tus yuam sij subscription rau cov peev txheej. -
TRANSLATOR_ENDPOINT— lub cheeb tsam endpoint URL. -
TRANSLATOR_REGION— cov peev txheej Azure cheeb tsam.
Step 2: Ntxiv cov workflow
Tsim .github/workflows/translate.yml:
name: translate
on: push: branches: [main] paths: - "src/**/*.en.resx" - "src/**/*.en.json"
permissions: contents: write pull-requests: write
jobs: translate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - id: translate uses: IEvangelist/resource-translator@v3 with: sourceLocale: en subscriptionKey: ${{ secrets.TRANSLATOR_KEY }} endpoint: ${{ secrets.TRANSLATOR_ENDPOINT }} region: ${{ secrets.TRANSLATOR_REGION }} toLocales: '["fr","de","es"]' - if: steps.translate.outputs.has-new-translations == 'true' uses: peter-evans/create-pull-request@v7 with: title: ${{ steps.translate.outputs.summary-title }} body: ${{ steps.translate.outputs.summary-details }} branch: machine-translationStep 3: Cog lus ib qho ntaub ntawv peev txheej
Cov ntaub ntawv peev txheej siv cov Name.<sourceLocale>.<ext> lus cog tseg. Piv txwv li Greetings.en.resx dhau los ua Greetings.fr.resx, Greetings.de.resx thiab lwm yam tom qab khiav.
Step 4: Xyuas cov zis
Thaum lub workflow tiav, qhov kev txiav txim nthuav tawm peb cov zis uas koj tuaj yeem xaim rau hauv PR cov lus piav qhia: summary-title, summary-details thiab has-new-translations. Nws kuj sau ib tug Markdown ntsiab lus rau hauv txoj hauj lwm nplooj ntawv los ntawm core.summary.