Guides
GitHub Actions
To streamline a continuous localization workflow, you can lint and translate strings automatically on CI systems like GitHub Actions.
By authenticating the CLI with an API key, you can invoke it as part of your continuous integration workflow (e.g. on GitHub Actions).
Here's an example workflow that:
- Checks for lint issues on every push
- Translates any missing strings once you switch from "Draft" to "Ready for review"
.github/workflows/i18n.yml
name: i18non:pull_request:types: [opened, synchronize, reopened, ready_for_review]jobs:i18n:runs-on: ubuntu-latestpermissions:contents: writesteps:- uses: actions/checkout@v4with:ref: ${{ github.event.pull_request.head.ref }}- run: npm ci# Issues should be fixed also in draft mode- run: npx eloqnt lint# Once ready for review, translate missing strings- if: ${{ !github.event.pull_request.draft }}env:ELOQNT_TOKEN: ${{ secrets.ELOQNT_TOKEN }}run: |npx eloqnt reviewnpx eloqnt translategit config user.name "$GITHUB_ACTOR"git config user.email "$GITHUB_ACTOR_ID+$GITHUB_ACTOR@users.noreply.github.com"git add -Agit diff --quiet --cached || (git commit -m "Translate missing strings" && git push)
Note that commits pushed with the default GITHUB_TOKEN don't run workflows. To have workflows run automatically on pushed commits, create a fine-grained personal access token with read and write access, and pass it to the checkout step:
.github/workflows/i18n.yml
# ...- uses: actions/checkout@v4with:ref: ${{ github.event.pull_request.head.ref }}token: ${{ secrets.GH_TOKEN }}# ...