Skip to content

Localize Android Apps with Zero XML Hassle

Translate your Android applications while preserving the native XML resource structure - no special adapters or format conversions needed.

Quick Configuration

Set up Android localization in three steps:

  1. Create your i18n.json configuration file
  2. Define source and target languages
  3. Point to your resource files using the [locale] placeholder
json
{
  "version": 1.2,
  "locale": {
    "source": "en",
    "targets": ["es", "fr", "de", "ja"]
  },
  "buckets": {
    "android": {
      "include": ["res/values-[locale]/strings.xml"]
    }
  }
}

TIP

The [locale] placeholder automatically expands to the appropriate locale code for each target language.

Handling Android's Default Resources Folder

Android requires a default values/ folder for your source language. To make this work with Lingo.dev:

  1. Rename your default folder to match your source locale (e.g., values-en/)
  2. Create a symbolic link to maintain Android compatibility:
bash
# From your project root
cd res
ln -s values-en values

This approach satisfies both Android's requirements and Lingo.dev's localization system.

One Command to Translate Everything

Run a single command to translate all your Android resources:

bash
npx lingo.dev@latest i18n

This automatically:

  • Processes all XML resource files
  • Preserves formatting, attributes, and structure
  • Creates properly formatted target language files
  • Updates only what's changed since last run

Target Specific Languages or Files

Focus your translation efforts with these options:

bash
# Translate to Spanish only
npx lingo.dev@latest i18n --locale es

# Translate just one file
npx lingo.dev@latest i18n --file res/values-en/strings.xml

Complete Support for Android Resource Types

Lingo.dev handles all Android resource formats with precision:

1. Basic Strings

xml
<resources>
    <string name="app_name">My App</string>
    <string name="welcome_message">Welcome to my app!</string>
</resources>
xml
<resources>
    <string name="app_name">Mi Aplicación</string>
    <string name="welcome_message">¡Bienvenido a mi aplicación!</string>
</resources>

2. String Arrays

xml
<resources>
    <string-array name="planets_array">
        <item>Mercury</item>
        <item>Venus</item>
        <item>Earth</item>
    </string-array>
</resources>
xml
<resources>
    <string-array name="planets_array">
        <item>Mercurio</item>
        <item>Venus</item>
        <item>Tierra</item>
    </string-array>
</resources>

3. Plurals

xml
<resources>
    <plurals name="numberOfSongsAvailable">
        <item quantity="one">%d song found.</item>
        <item quantity="other">%d songs found.</item>
    </plurals>
</resources>
xml
<resources>
    <plurals name="numberOfSongsAvailable">
        <item quantity="one">%d canción encontrada.</item>
        <item quantity="other">%d canciones encontradas.</item>
    </plurals>
</resources>

Format Preservation Features

Lingo.dev maintains all the special formatting Android requires:

HTML Markup

xml
<!-- Original -->
<string name="welcome">Welcome to <b>Android</b>!</string>

<!-- Translation preserves HTML tags -->
<string name="welcome">Bienvenido a <b>Android</b>!</string>

Format Specifiers

xml
<!-- Original -->
<string name="welcome_message">Hello, %1$s! You have %2$d new messages.</string>

<!-- Translation maintains format specifiers -->
<string name="welcome_message">¡Hola, %1$s! Tienes %2$d mensajes nuevos.</string>

Advanced XML Features

  • CDATA Sections: <string name="html_content"><![CDATA[<html>...</html>]]></string>
  • String References: <string name="app_welcome">Welcome to @string/app_name</string>
  • Special Characters: \@, \?, \#, \$, \% are preserved correctly
  • Tools Namespace: tools:ignore="MissingTranslation" attributes are maintained
  • Translatable Flags: Respects translatable="false" to skip certain strings

Developer Best Practices

  1. Add Context Comments: Help translators understand string usage

    xml
    <!-- This appears on the home screen -->
    <string name="welcome_title">Welcome</string>
  2. Use String References: Maintain consistency with Android's reference system

    xml
    <string name="app_welcome">Welcome to @string/app_name</string>
  3. Leverage CI/CD: Add translation verification to your pipeline with --frozen

  4. Organize Resources: Group related strings in separate files for easier management

By integrating Lingo.dev into your Android development workflow, you maintain all the benefits of Android's native resource system while gaining powerful AI-driven translation capabilities.