Skip to content

Sync Crowdin en_US Translations #159

Sync Crowdin en_US Translations

Sync Crowdin en_US Translations #159

---
# Ensures that en_US translations in Crowdin exactly mirror the source strings,
# and automatically approves them.
#
# For each configured project the script will:
# • Fetch all source strings.
# • For each source string, verify that the en_US translation matches.
# • Add the translation if it is missing.
# • Replace the translation if it is stale (does not match the source).
# • Approve the en_US translation if it is not already approved.
#
# Required GitHub repository configuration:
# secrets.CROWDIN_TOKEN – Crowdin personal access token
# vars.CROWDIN_PROJECT_IDS – Comma-separated list of Crowdin project IDs
# (e.g. "123456" or "123456,789012")
name: Sync Crowdin en_US Translations
permissions: {}
on:
schedule:
# Run every 6 hours so translations stay in sync with source strings.
- cron: '0 */6 * * *'
workflow_dispatch: # Allow ad-hoc manual runs
# Only one sync at a time; never cancel an in-progress run.
concurrency:
group: crowdin-en-us-sync
cancel-in-progress: false
jobs:
sync:
name: Sync en_US translations to match source strings
runs-on: ubuntu-latest
permissions:
contents: read
if: github.repository_owner == 'LizardByte' # don't run for forks
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 'node'
- name: Install dependencies
run: npm install --ignore-scripts
- name: Sync en_US translations
env:
CROWDIN_TOKEN: ${{ secrets.CROWDIN_TOKEN }}
CROWDIN_PROJECT_IDS: ${{ vars.CROWDIN_PROJECT_IDS }}
run: node src/sync-crowdin-en-us.js