Android XML

Last updated: January 05, 2022Author: Jakub Pomykała

This file format has been discontinued in favor of Android Strings. Deprecated format: android-xml, new format: android-strings.

A common format used in Android localization and translation is XML. Regular strings.xml files keep translation keys in name attribute, and the value of <string></string> tag is a localized message.

Values from strings.xml can be used in Android Java code using a reference R.string.string_name. You can also access localized strings in your XML layout files by using @string/string_name. The string_name value used in examples is a translation key.

File format example

<resources>
    <string name="app_name">SimpleLocalize.io</string>
    <string name="welcome_message">Welcome in SimpleLocalize!</string>
    <string name="save_button">Save</string>
    <string name="back_button">Back</string>
</resources>

Every string.xml file sits in a separate values-{lang} directory, as shown below.

android localization files structure

We have special integration for Android! See Android - quick integration guide to make your work with this platform less time-consuming.

Upload with CLI

simplelocalize upload --apiKey <PROJECT_KEY> \
  --uploadFormat android-xml \
  --uploadPath ./values-{lang}/strings.xml

Learn more about SimpleLocalize CLI and translations upload feature.

Download with CLI

You cannot download translations in CSV format. In the example below we put excel format which allow you to see all the translations and translation keys in spreadsheet format.

simplelocalize download --apiKey <PROJECT_KEY> \
  --downloadFormat android-xml \
  --downloadPath ./values-{lang}/strings.xml

Learn more about SimpleLocalize CLI and translations download feature.

Import with API

curl
    --request POST \
    --url 'https://api.simplelocalize.io/api/v2/import?uploadFormat=android-xml' \
    --header 'x-simplelocalize-token: <API_KEY>' \
    --form file=@/path/to/your/strings.xml

Learn more about importing translations with API

Export with API

curl
    --request GET \
    --url https://api.simplelocalize.io/api/v3/export?downloadFormat=android-xml \
    --header 'x-simplelocalize-token: <API_KEY>'

Learn more about exporting translations with API