Android

Languine supports Android string resources (strings.xml) as a source format, handling plurals, string arrays, and formatted strings. This format is the standard way to manage translations in Android applications.


Setting Up

First, make sure you've got a languine.json config file in your project root. Here's an example:

typescript
{
  "locale": {
    "source": "en",
    "targets": ["sv", "de", "fr"]
  },
  "files": {
    "android": {
      "include": ["app/src/main/res/values-[locale]/strings.xml"]
    }
  }
}

Translating

With your config set, run:

typescript
npx languine@latest translate

When you run this command, Languine will:

  • Load your source strings.xml file (e.g., values/strings.xml)
  • Detect any new or modified translation strings
  • Generate translations for your target languages
  • Create or update the target language XML files (e.g., values-sv/strings.xml, values-de/strings.xml, values-fr/strings.xml)
  • Preserve any existing string arrays and plurals formatting