Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Android App Localization Example

Demonstrates localizing Android strings.xml resources with the Lingo.dev CLI (@lingo.dev/cli). Source strings live in the default app/src/main/res/values/, and the CLI writes each target locale into its own qualified resource directory.

Full walkthrough: lingo.dev/en/guides/android-app-localization

What's inside

  • app/src/main/res/values/strings.xml — source strings (English)
  • app/src/main/res/values-*/strings.xml — translated resources, committed
  • .lingo/config.json — Lingo.dev CLI configuration

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

This repo ships fully translated; after you edit a string in values/strings.xml, 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

values/ has no locale qualifier — in Android that is the default language. The CLI recognises the bare values/ segment as the source locale and appends the target qualifier to it:

Locale Resource directory
en (source) app/src/main/res/values/
es app/src/main/res/values-es/
fr app/src/main/res/values-fr/
de app/src/main/res/values-de/
pt-BR app/src/main/res/values-pt-rBR/

Note the last row. A locale qualifier is not a raw BCP 47 tag — values-pt-BR/ is not a valid directory name, the build system ignores it, and the strings would exist without ever loading. Android accepts two spellings instead: the legacy language-region form (values-pt-rBR/), and a BCP 47 form prefixed with b+ (values-b+pt+BR/, API 24+). The CLI writes the legacy form whenever it can express the locale and falls back to b+ when it cannot — scripts, three-letter languages and numeric regions, e.g. values-b+zh+Hans/ and values-b+es+419/.

<string>, <string-array> and <plurals> entries are all translated, keyed by their resource name. Format specifiers like %d are preserved, resource names and attributes are left alone, entry order is kept, and translatable="false" resources are skipped. Comments live in the source file only — they are not copied into the translated resources.

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, pt-BR

Links

About

Demonstrates automated Android localization with strings.xml using Lingo.dev CLI and GitHub Actions

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors