Skip to main content

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

InputRequiredDefaultDescription
api_keyYes-Langbly API key (store as GitHub secret)
source_fileYes-Path to source i18n file (e.g., locales/en.json)
source_langNoenSource language code (ISO 639-1)
target_langsYes-Comma-separated target languages (e.g., nl,de,fr)
output_dirNosame as sourceOutput directory for translated files
file_formatNoauto-detectjson or yaml
flat_keysNofalseTreat keys as flat (no nested traversal)
create_prNofalseCreate a PR with the translations
pr_branchNoauto-generatedBranch name for the PR

Outputs

OutputDescription
translated_filesComma-separated list of translated file paths
languages_translatedNumber of languages translated
characters_usedApproximate 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

  1. Sign up for free (500K characters, no credit card)
  2. Go to your Dashboard and create an API key
  3. In your GitHub repo: Settings > Secrets and variables > Actions
  4. Click New repository secret
  5. 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

TierPrice/moCharacters
Free$0500K
Starter$19/mo5M
Growth$69/mo25M
Scale$199/mo100M

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.

Need Help?

Contact us at hello@langbly.com or visit langbly.com.