Synchronize translation files between your repository and Locize. It uses the Locize CLI behind the scene. For detailed documentation of the Locize CLI, please visit the documentation.
The api-key that should be used. Required unless LOCIZE_API_KEY (or LOCIZE_APIKEY) is set in the environment.
The project-id that should be used. Required unless LOCIZE_PROJECTID (or LOCIZE_PROJECT_ID) is set in the environment.
Optional Specify the path that should be used (default: current working directory).
Optional The version that should be targeted (default: latest).
Optional File format of namespaces (default: json; [nested, flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-rails-ns, yaml-nested, yml, yml-rails, yml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties, xcstrings]).
Optional Removes all local files by removing the whole folder before downloading (default: false).
Optional Removes all local files without removing any folder (default: false).
Optional Update values of existing translations on locize (default: false).
Optional Trigger automatic AI/MT translation of updated translations (default: false). When enabled, any new or updated keys synced to the reference language will be automatically translated into all target languages using the project's configured AI or MT provider.
Optional Skip the removal of keys on locize that were deleted locally (default: false).
Optional Delete a complete namespace on locize if the local file in the reference language was deleted (default: false).
Optional Skips to download empty files (default: false).
Optional Check for changes in reference language only (default: true).
Optional Only sync keys that changed on the current git branch compared to the base branch (default: false). The local reference-language files are diffed against the merge-base with the base branch; additions, value updates and auto-translation are restricted to those keys, and deletions are skipped. Keys are scoped per namespace file, and when any plural variant of a key changed, all its plural forms are included. Requires locize-cli >= 12.7 (installed automatically) and a checkout that includes the base branch, e.g. actions/checkout with fetch-depth: 0.
Optional The git base branch/ref to compare against for changed-only (default: auto-detect origin/HEAD, then main, then master).
Optional Take file modification time into account when comparing local and remote (default: false).
Optional The language that should be targeted.
Optional Comma-separated list of languages that should be targeted.
Optional The namespace that should be targeted (comma-separated list supported).
Optional This will be added as a local folder name prefix in front of the language.
Optional This will define the folder and file structure; do not add a file extension (default: {{language}}/{{namespace}}).
Optional Downloads the current (unpublished) translations. This will generate private download costs (default: false).
Optional Downloads only the current overridden (unpublished) translations of a tenant or branch project (default: false).
Optional The branch name (or id) that should be targeted.
Optional Dry run — show what would change without actually syncing (default: false).
Optional Specify the cdn endpoint that should be used (standard or pro, default: standard).
Optional Saves the segments that will be deleted in this path.
- uses: locize/sync@v2
with:
api-key: ${{ secrets.LOCIZE_API_KEY }}
project-id: ${{ secrets.LOCIZE_PROJECT_ID }}
path: locales- uses: locize/sync@v2
with:
api-key: ${{ secrets.LOCIZE_API_KEY }}
project-id: ${{ secrets.LOCIZE_PROJECT_ID }}
path: locales
auto-translate: truesteps:
- uses: actions/checkout@v4
- uses: locize/sync@v2
with:
api-key: ${{ secrets.LOCIZE_API_KEY }}
project-id: ${{ secrets.LOCIZE_PROJECT_ID }}
path: locales
auto-translate: true
- run: npx locize-cli publish-version
env:
LOCIZE_API_KEY: ${{ secrets.LOCIZE_API_KEY }}
LOCIZE_PROJECTID: ${{ secrets.LOCIZE_PROJECT_ID }}- uses: locize/sync@v2
with:
api-key: ${{ secrets.LOCIZE_API_KEY }}
project-id: ${{ secrets.LOCIZE_PROJECT_ID }}
path: locales
branch: feature-v2Only the keys the PR added or modified are synced and auto-translated; nothing is deleted. The base branch must be available in the checkout, so use fetch-depth: 0:
on:
pull_request:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: locize/sync@v2
with:
api-key: ${{ secrets.LOCIZE_API_KEY }}
project-id: ${{ secrets.LOCIZE_PROJECT_ID }}
path: locales
auto-translate: true
changed-only: true