Skip to content
tuistPublic

About

A harness for continuous translation of software content

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

l10n

Translate repository content and open a pull request with the changes. Supports Markdown, JSON, YAML, gettext, Apple strings, and Android XML.

📦 Install

With mise:

mise use -g github:tuist/l10n@latest

⚙️ Configure

Run l10n init to create L10N.md, then choose your source files and languages:

---
source_language: en
model: gpt-4.1
sources:
  "docs/**/*.md": "i18n/{locale}/{relpath}"
targets: [de, es]
---

Describe your product, audience, and terminology here.

To translate from your terminal, set L10N_API_KEY in your environment and run:

l10n plan
l10n translate

Completion requests have a ten-minute deadline. Set L10N_REQUEST_TIMEOUT_SECONDS to a positive integer to override it, including in your workflow's env.

Use l10n translate --jobs 4 (or jobs: '4' in the action) to translate up to four files concurrently. The default is one; choose a limit your provider can handle. Validation and durable checkpoint publication stay serialized, and completed files remain reusable after cancellation or failure.

For providers that support strict JSON-schema array responses, set L10N_STRUCTURED_OUTPUT=true to require exactly one result per input unit. This is opt-in; existing translation memory remains reusable and l10n still validates the response.

Commit the translations and .10n/ locks. l10n skips unchanged inputs and protects manual translation edits. Ignore .l10n/ in Git; it holds the local cache and run report.

🤖 GitHub Actions

Add L10N_API_KEY to your repository secrets and save this as .github/workflows/translate.yml:

name: Translations
on:
  push:
    branches: [main]

permissions:
  contents: write
  pull-requests: write

concurrency:
  group: translations
  cancel-in-progress: true

jobs:
  translate:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v7
      - uses: tuist/l10n@main
        with:
          api-key: ${{ secrets.L10N_API_KEY }}
          cache: 'false'

Enable Allow GitHub Actions to create and approve pull requests in your repository's Actions settings. The action creates or updates one PR when translations change. Pin the action to a release commit for reproducible runs. Pass a GitHub App token through token if the translation PR needs to trigger other workflows.

The action checkpoints each validated translation, lock, and translation memory on l10n/translations-checkpoints (or <branch>-checkpoints for a custom branch). New commits can cancel older runs without losing completed files. The next run restores and revalidates that memory; only unfinished or changed work needs inference. Do not edit or delete the checkpoint branch manually.

GitHub Actions cache also speeds up restores. Both persistence mechanisms work with cache: 'false', which disables only the optional Struo remote cache. Changing the provider, model, language, or guidance gives translation pieces new cache keys.

About

A harness for continuous translation of software content

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages