Step 1: Kgetha mofetoledi
The action works with Azure AI Translator, AWS Translate, and Google Cloud Translation behind one unified API surface. Pick a single provider per run with the provider input — the workflow behaves identically regardless of provider; ke fela ditaodišosengwalo tše di fapafapanego. Lebelela Bafetoledi go bapetša ka botlalo.
Step 2: Add credentials and a workflow
Boloka boitsebišo bja mofani wa gago bjalo ka diphiri tša polokelo ya GitHub, gomme o hlame .github/workflows/translate.yml. Select your provider below for its specific setup — the rest of the workflow is identical.
Azure AI Translator
Azure ke moabi yo a fošagetšego, ka fao provider ka tlogelwa. Fana ka mothopo wa Azure AI Translator ka gare ga portal ya Azure, gomme o boloke mangwalo a yona:
Boloka tše bjalo ka diphiri tša polokelo
TRANSLATOR_KEY— Senotlelo sa sengwalwa sa sengwalwa.TRANSLATOR_ENDPOINT— Lego Ninjago Endpoint URLTRANSLATOR_REGION— Selete sa Azure.
Add the workflow
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: provider: | azure: subscriptionKey: ${{ secrets.TRANSLATOR_KEY }} endpoint: ${{ secrets.TRANSLATOR_ENDPOINT }} region: ${{ secrets.TRANSLATOR_REGION }} sourceLocale: en 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-translationAWS Translate
Go provider aws. Kgetha OIDC ka aws-actions/configure-aws-credentials gore go se be le diphiri tša lebaka le letelele tše di bolokwago — kgato ya diromelwantle e AWS_REGION go wena. Go diriša dinotlelo tše di sa fetogego, boloka:
Boloka tše bjalo ka diphiri tša polokelo
AWS_ACCESS_KEY_ID— Your AWS Access Key ID.AWS_SECRET_ACCESS_KEY— Your AWS Secret Access Key
A region is always required — set it with awsRegion or the AWS_REGION environment variable.
Add the workflow
name: translate
on: push: branches: [main] paths: - "src/**/*.en.resx" - "src/**/*.en.json"
permissions: id-token: write # for aws-actions/configure-aws-credentials (OIDC) contents: write pull-requests: write
jobs: translate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::123456789012:role/gh-actions-translate aws-region: us-east-1 - id: translate uses: IEvangelist/resource-translator@v3 with: provider: | aws: region: us-east-1 # or rely on AWS_REGION from the step above formality: FORMAL brevity: true sourceLocale: en 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-translationGoogle Cloud Translation
Go provider google. Authenticate with either a service-account JSON credential or an API key — provide exactly one:
Boloka tše bjalo ka diphiri tša polokelo
GCP_TRANSLATE_CREDENTIALS— Senotlelo sa JSON sa akhaonte ya tirelo (bjalo ka thapo ya JSON).GCP_TRANSLATE_API_KEY— goba senotlelo sa Google Cloud API.
Setifikeiti sa boikgethelo se googleProjectId tšewa go tšwa go setifikeiti ge se tlogetšwe.
Add the workflow
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: provider: | google: # Provide EITHER a service-account JSON credential... credentials: ${{ secrets.GCP_TRANSLATE_CREDENTIALS }} # ...OR an API key: # apiKey: ${{ secrets.GCP_TRANSLATE_API_KEY }} model: nmt sourceLocale: en 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: Commit a source resource file
Ditaodišosengwalo tša Sepedi di diriša thulaganyo ya Name.<sourceLocale>.<ext> Go fa mohlala, Greetings.en.resx ba Greetings.fr.resx, Greetings.de.resx, bjalobjalo.
Step 4: Let smart change detection protect your bill
changeDetection defaults to smart and stores a compact .github/resource-translator-state.json manifest in the repo. Commit that file so future runs can reuse stable translations, preserve manual target edits, and send only new, missing, changed, or settings-invalidated keys to the provider. If localized files already exist, run once with snapshotOnly: true to create the manifest without provider calls.
Step 5: Hlahloba setšweletšwa
Ge mošomo o fedile, tiro e utolla ditšweletšwa tše tharo tšeo o ka di kgokaganyago ka tlhalošo ya PR: summary-title, summary-details le has-new-translations. Gape e ngwala kakaretšo ya Markdown mo letlakaleng la mošomo ka core.summary.