Build an Automated Translation CI/CD Pipeline with Lingo.dev and Knock
Imagine launching your app globally without translation headaches. No more spreadsheets, no frantic emails—just pure automation. With Lingo.dev and Knock, that dream is reality. This guide walks you through setting up a seamless translation CI/CD pipeline, making localization effortless. Let’s dive in!
The Power of AI-Powered Localization
Localization is crucial for global app success, but manual translation is slow and error-prone. Enter Lingo.dev and Knock, your AI-driven translation and notification automation duo.
- Lingo.dev: AI-powered translations across 83+ languages with customizable brand voice. Truely’s team swears by its consistency in 36 languages.
- Knock: Automates localized notifications with simple Liquid templates like
{{ "OrderReady" | t }}
to serve the right language based on user locale. - Why automate? The manual method is outdated. Lingo.dev and Knock accelerate time-to-market while ensuring translation accuracy.
Crafting Seamless Notifications with Knock
Knock simplifies notification localization with:
- Translation Filters: Use
t
in Liquid templates ({{ "OrderReady" | t }}
) to dynamically insert the correct translation. - Organized JSON Files: Keep translations structured (
en.json
,fr.json
) and use namespaces (shipping.fr.json
) for scalable management. - User Locale Detection: Knock adapts to user preferences dynamically, falling back to the best-matching language when needed.
Setting Up Your Translation Workflow
Local Translation with Lingo.dev CLI
-
Install & Authenticate:
npm install -g lingo.dev
, thennpx lingo.dev@latest auth --login
. -
Configure Localization: Run
npx lingo.dev@latest init
to generate ani18n.json
config:{ "sourceLocale": "en", "targetLocales": ["es", "fr", "de"], "buckets": [{ "input": "locales/en.json", "output": "locales/[locale].json" }] }
-
Generate Translations:
npx lingo.dev@latest i18n
creates translated files, tracking changes withi18n.lock
.
Automating with GitHub Actions
- Translate on PRs:
name: Translate on PR on: push jobs: translate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: lingodotdev/lingo.dev@main with: { api-key: ${{ secrets.LINGODOTDEV_API_KEY }} }
- Deploy to Knock on Merge:
name: Deploy to Knock on: push jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - run: npm install -g @knocklabs/knock-cli - run: knock translation push --all env: { KNOCK_API_KEY: ${{ secrets.KNOCK_API_KEY }} }
Real-World Example
Adding "WelcomeMessage": "Welcome to the app!"
to en.json
triggers automatic translation and upload to Knock upon merging. Users instantly receive localized notifications—no manual work required.
Why This Pipeline is a Game-Changer
- Focus on One Language: Write in English; automation handles the rest.
- Single-Template Simplicity: One Knock template serves all languages.
- Version-Controlled Translations: Store translations in Git for easy auditing.
- Zero Manual Hassle: Lingo.dev’s
i18n.lock
ensures only new content gets translated.
Taking Localization to the Next Level
Ensuring Quality
- AI Review & Human Checks: Use Lingo.dev’s brand tuning and Knock’s review workflows.
- Error Prevention: CI/CD validation catches mistakes before deployment.
Handling Complex Localization
- Pluralization & Gender: Lingo.dev’s MessageFormat ensures grammatical accuracy.
- Regional Variants: Support
en-GB
vs.en-US
with simple config tweaks. - Live Testing: Knock’s preview tools let you validate translations in-app.
Optimizing for Scale
- Efficient Updates:
i18n.lock
translates only what’s new. - Cost Savings: Lingo.dev’s predictable pricing beats manual agencies.
- Global Readiness: 83+ languages at your fingertips with a scalable pipeline.
Wrap-Up: Your App, Global-Ready
By automating translation with Lingo.dev and Knock, you streamline localization, cut costs, and reach users worldwide effortlessly. Ready to revolutionize your app’s global experience? Start automating today!