XML (Android) Format Guide
XML is the standard localization format for native Android applications, using the strings.xml
file structure.
Why use XML for Android?
Native Android format — Required for Android Studio and native Android development
Rich metadata support — Comments, descriptions, and context information
Built-in plural handling — Native support for complex plural rules
Resource optimization — Android system optimizes XML resources for performance
Basic structure
Standard strings.xml file
<?xml version="1.0" encoding="utf-8"?><resources>
<string name="app_name">MyApp</string>
<string name="welcome">Welcome to our app!</string>
<string name="login">Log in</string>
<string name="signup">Sign up</string></resources>
With comments and descriptions
<?xml version="1.0" encoding="utf-8"?><resources>
<!-- Authentication screen strings -->
<string name="login_title">Log in to your account</string>
<string name="email_hint">Enter your email</string>
<!-- Button labels -->
<string name="btn_submit">Submit</string>
<string name="btn_cancel">Cancel</string></resources>
Variables and formatting
Simple variables
<string name="welcome_user">Welcome, %s!</string><string name="items_count">You have %d items</string><string name="price_display">Price: $%.2f</string>
Positional arguments
<string name="user_stats">Hello %1$s, you have %2$d messages and %3$d notifications</string>
Named arguments (Android 7.0+)
<string name="welcome_message">Welcome, %s! Today is %s</string>
Plural forms in Android XML
Standard plurals
<plurals name="files_count">
<item quantity="one">%d file</item>
<item quantity="other">%d files</item></plurals>
Complex plural rules (for languages like Russian)
<plurals name="files_count">
<item quantity="one">%d файл</item>
<item quantity="few">%d файла</item>
<item quantity="many">%d файлов</item></plurals>
Using plurals in code
// Javaint count = 5;String text = getResources().getQuantityString(R.plurals.files_count, count, count);
// Kotlinval count = 5val text = resources.getQuantityString(R.plurals.files_count, count, count)
Special characters and escaping
Characters that need escaping
<!-- Apostrophes and quotes --><string name="dont_forget">Don\'t forget to save!</string><string name="quoted_text">He said \"Hello world\"</string>
<!-- HTML entities --><string name="copyright">Copyright © 2024</string><string name="less_than">Value < 100</string><string name="greater_than">Value > 50</string><string name="ampersand">Tom & Jerry</string>
New lines and formatting
<!-- Line breaks --><string name="multiline_text">Line 1\nLine 2\nLine 3</string>
<!-- Preserving spaces --><string name="spaced_text">" This text has spaces "</string>
<!-- HTML formatting (if supported by your app) --><string name="formatted_text"><b>Bold</b> and <i>italic</i> text</string>
Special Android escapes
<!-- Literal backslash --><string name="path">C:\\Users\\Name</string>
<!-- Unicode characters --><string name="unicode_symbol">\u00A9</string>
<!-- Prevent processing --><string name="raw_text" translatable="false">%s %d %f</string>
Android-specific attributes
Translatable attribute
<!-- Mark strings as non-translatable --><string name="api_key" translatable="false">sk_test_123456789</string><string name="debug_tag" translatable="false">DEBUG</string>
<!-- Default is translatable="true" --><string name="user_message">Hello user!</string>
Formatted attribute
<!-- Disable formatting for performance --><string name="simple_text" formatted="false">Simple text without formatting</string>
<!-- Enable formatting (default) --><string name="formatted_text" formatted="true">Welcome, %s!</string>
File organization
Directory structure
res/
├── values/
│ └── strings.xml (default language)
├── values-es/
│ └── strings.xml (Spanish)
├── values-fr/
│ └── strings.xml (French)
└── values-ru/
└── strings.xml (Russian)
Multiple string files
<!-- strings.xml (main strings) --><?xml version="1.0" encoding="utf-8"?><resources>
<string name="app_name">MyApp</string></resources>
<!-- strings_errors.xml (error messages) --><?xml version="1.0" encoding="utf-8"?><resources>
<string name="error_network">Network error</string>
<string name="error_validation">Invalid input</string></resources>
Working with XML in Localit.io
Upload process
-
Select XML (Android) format during file upload
-
System automatically recognizes string and plural elements
-
Comments are preserved and available to translators
-
Enable "Convert to universal placeholders" for multi-platform projects

Key recognition
Localit.io automatically handles:
-
Regular strings:
<string name="key">value</string>
-
Plural forms:
<plurals name="key"><item quantity="one">...</item></plurals>
-
Comments: Preserved as translator context
-
Attributes: Translatable and formatted attributes
Export options
When exporting to Android XML:
-
Preserve structure — Maintains original XML formatting
-
Include comments — Adds translator notes as XML comments
-
Handle plurals — Automatically formats plural rules correctly
-
Escape characters — Properly escapes special characters
Best practices
Organize strings by feature
✅ Good organization:
<!-- Authentication --><string name="auth_login_title">Log in</string><string name="auth_signup_title">Sign up</string><string name="auth_forgot_password">Forgot password?</string>
<!-- Navigation --><string name="nav_home">Home</string><string name="nav_profile">Profile</string><string name="nav_settings">Settings</string>
Use consistent naming conventions
✅ Consistent naming:
<string name="button_save">Save</string><string name="button_cancel">Cancel</string><string name="error_network">Network error</string><string name="error_validation">Validation error</string>
❌ Inconsistent naming:
<string name="save_btn">Save</string><string name="cancel">Cancel</string><string name="network_error">Network error</string><string name="validationErr">Validation error</string>
Add meaningful comments
✅ Helpful comments:
<!-- Shown when user successfully completes purchase --><string name="purchase_success">Thank you for your purchase!</string>
<!-- Error displayed when network is unavailable (max 50 chars) --><string name="error_offline">No internet connection</string>
Handle screen size constraints
<!-- Different strings for different screen sizes --><string name="welcome_message">Welcome to our application!</string><string name="welcome_message_short">Welcome!</string>
Advanced Android features
String arrays
<string-array name="countries">
<item>United States</item>
<item>Canada</item>
<item>United Kingdom</item>
<item>Germany</item></string-array>
Quantity strings with complex formatting
<plurals name="download_progress">
<item quantity="one">%1$d of %2$d file downloaded</item>
<item quantity="other">%1$d of %2$d files downloaded</item></plurals>