Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

TypeScript Locale Modules Localization Example

Demonstrates localizing TypeScript locale modules with the Lingo.dev CLI (@lingo.dev/cli) push/pull flow. Each locale is a set of typed .ts modules that export plain string objects — the CLI translates the string values and leaves keys, structure, and as const untouched.

Full walkthrough: lingo.dev/en/guides/static-content

What's inside

  • src/locales/en/*.ts — source locale modules (English)
  • .lingo/config.json — Lingo.dev CLI configuration (typescript format)

Each module has a default-exported object of UI strings:

export default {
  appName: "Ledger",
  nav: { dashboard: "Dashboard", settings: "Settings" },
} as const;

Quick start

# 1. Install the CLI (or prefix commands with `npx`)
npm install -g @lingo.dev/cli

# 2. Authenticate and link this repo to your engine
lingo login
lingo link

# 3. Translate changed source into every locale
lingo push --wait

Translations are committed per locale under src/locales/<locale>/, mirroring the English modules. This repo ships fully translated. After you edit an English module, lingo push --wait translates only the delta. To bootstrap a brand-new locale, add it to .lingo/config.json and run lingo push --backfill-missing.

How it works

lingo push parses each source module, diffs it against .lingo/lock.json, and translates only the string literals through your linked engine. Object keys, nested structure, as const assertions, comments, and placeholders like {count} are preserved — only the translatable string values change. Results are written per locale into src/locales/<locale>/.

Because the output is plain typed TypeScript, your app imports each locale's modules directly — no runtime parsing, and the structure stays identical across locales.

Automate in CI (optional)

Want translations on every push or PR without running the CLI yourself? See the CI/CD Workflows guide — the Lingo.dev GitHub App translates automatically once installed. The App reads engineId from the committed .lingo/config.json, so run lingo link and commit the updated file before installing it.

Locales

  • Source: en
  • Targets: es, fr, de

Links

About

Demonstrates localizing TypeScript locale modules with the Lingo.dev CLI push/pull flow

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages