Android XML

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.

<resources>
    <string name="app_name" translatable="false">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 separate values-{lang} directory like 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 \
  --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 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 \
  --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' \
    --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 \
    --header 'x-simplelocalize-token: <API_KEY>'

Learn more about exporting translations with API