GitHub Action
Automatically translate your i18n files (JSON, YAML) in CI/CD using the Langbly GitHub Action. Keep translations in sync with every push.
Quick Start
# .github/workflows/translate.yml
name: Translate i18n files
on:
push:
paths:
- 'locales/en.json'
jobs:
translate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Langbly/langbly-i18n-action@v1
with:
api_key: ${{ secrets.LANGBLY_API_KEY }}
source_file: locales/en.json
target_langs: nl,de,fr,es
create_pr: true
This workflow triggers when locales/en.json changes, translates it to 4 languages, and creates a PR with the translations.
Inputs
| Input | Required | Default | Description |
|---|---|---|---|
api_key | Yes | - | Langbly API key (store as GitHub secret) |
source_file | Yes | - | Path to source i18n file (e.g., locales/en.json) |
source_lang | No | en | Source language code (ISO 639-1) |
target_langs | Yes | - | Comma-separated target languages (e.g., nl,de,fr) |
output_dir | No | same as source | Output directory for translated files |
file_format | No | auto-detect | json or yaml |
flat_keys | No | false | Treat keys as flat (no nested traversal) |
create_pr | No | false | Create a PR with the translations |
pr_branch | No | auto-generated | Branch name for the PR |
Outputs
| Output | Description |
|---|---|
translated_files | Comma-separated list of translated file paths |
languages_translated | Number of languages translated |
characters_used | Approximate characters translated |
Examples
Translate on push to main
on:
push:
branches: [main]
paths: ['src/i18n/en.json']
jobs:
translate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Langbly/langbly-i18n-action@v1
with:
api_key: ${{ secrets.LANGBLY_API_KEY }}
source_file: src/i18n/en.json
target_langs: nl,de,fr,es,it,pt,ja,ko,zh
create_pr: true
Translate YAML files
- uses: Langbly/langbly-i18n-action@v1
with:
api_key: ${{ secrets.LANGBLY_API_KEY }}
source_file: config/locales/en.yml
target_langs: nl,de,fr
file_format: yaml
Flat key format
For files with flat keys like {"home.title": "Welcome"} instead of nested {"home": {"title": "Welcome"}}:
- uses: Langbly/langbly-i18n-action@v1
with:
api_key: ${{ secrets.LANGBLY_API_KEY }}
source_file: messages/en.json
target_langs: nl,de
flat_keys: true
Custom output directory
- uses: Langbly/langbly-i18n-action@v1
with:
api_key: ${{ secrets.LANGBLY_API_KEY }}
source_file: en.json
target_langs: nl,de,fr
output_dir: translations
This outputs to translations/nl.json, translations/de.json, translations/fr.json.
Setting Up Your API Key
- Sign up for free (500K characters, no credit card)
- Go to your Dashboard and create an API key
- In your GitHub repo: Settings > Secrets and variables > Actions
- Click New repository secret
- Name:
LANGBLY_API_KEY, Value: your API key
Features
- JSON and YAML: Auto-detects format from file extension
- Nested keys: Recursively translates nested objects
- Flat keys: Supports dot-notation flat key files
- ICU placeholders: Preserves
{name},{count}etc. - HTML in values: Preserves HTML tags in translation strings
- Auto PR creation: Creates a clean PR with all translations
- 100+ languages: Same language support as the Langbly API
Pricing
| Tier | Price/mo | Characters |
|---|---|---|
| Free | $0 | 500K |
| Starter | $19/mo | 5M |
| Growth | $69/mo | 25M |
| Scale | $199/mo | 100M |
Plans are 81-90% cheaper than Google Translate ($20/M) and 85-92% cheaper than DeepL ($25/M).
Sign up for free to get started.
Links
- GitHub Marketplace: Langbly/langbly-i18n-action
Need Help?
Contact us at hello@langbly.com or visit langbly.com.