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:
- Create your
i18n.json
configuration file - Define source and target languages
- Point to your resource files using the
[locale]
placeholder
{
"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:
- Rename your default folder to match your source locale (e.g.,
values-en/
) - Create a symbolic link to maintain Android compatibility:
# 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:
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:
# 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
<resources>
<string name="app_name">My App</string>
<string name="welcome_message">Welcome to my app!</string>
</resources>
<resources>
<string name="app_name">Mi Aplicación</string>
<string name="welcome_message">¡Bienvenido a mi aplicación!</string>
</resources>
2. String Arrays
<resources>
<string-array name="planets_array">
<item>Mercury</item>
<item>Venus</item>
<item>Earth</item>
</string-array>
</resources>
<resources>
<string-array name="planets_array">
<item>Mercurio</item>
<item>Venus</item>
<item>Tierra</item>
</string-array>
</resources>
3. Plurals
<resources>
<plurals name="numberOfSongsAvailable">
<item quantity="one">%d song found.</item>
<item quantity="other">%d songs found.</item>
</plurals>
</resources>
<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
<!-- 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
<!-- 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
Add Context Comments: Help translators understand string usage
xml<!-- This appears on the home screen --> <string name="welcome_title">Welcome</string>
Use String References: Maintain consistency with Android's reference system
xml<string name="app_welcome">Welcome to @string/app_name</string>
Leverage CI/CD: Add translation verification to your pipeline with
--frozen
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.