Android localization

Translate your Android app with Localize.to. Manage your strings in one place, pull a native strings.xml per language, and ship your app in every language your users speak.

How it works

Localize.to stores your translation keys and their values in every language you enable. For Android, it renders them directly as an Android resource file — a strings.xml you can drop into app/src/main/res/values-<locale>/. No plugin, no Gradle task, no SDK — just a single HTTPS call per language.

Fetch strings.xml

Every project has a read key (see the API tab inside a project). Pass it as ?apikey= and add &format=android:

curl "https://api.localize.to/v1/language/en?apikey=READ_KEY&format=android" \
  -o app/src/main/res/values/strings.xml

The endpoint returns a ready-to-commit Android resource file:

<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <string name="sign_in">Sign in</string>
    <string name="sign_out">Sign out</string>
    <string name="welcome">Welcome, %1$s</string>
</resources>

Characters that have meaning in XML (&, <, >, quotes, newlines) are escaped for you, so the file is always Android-valid.

Resource folder naming

Android picks a values-<qualifier>/ folder based on the device locale. Common qualifiers you will use with Localize.to language codes:

Build-time integration (Gradle / shell)

The simplest integration is a short script that pulls every language into your repo before a build. A Gradle-friendly shell script:

#!/usr/bin/env bash
set -euo pipefail

API="https://api.localize.to/v1"
KEY="${LOCALIZE_READ_KEY:?set LOCALIZE_READ_KEY}"
RES="app/src/main/res"

declare -A LOCALES=(
  [en]="values"
  [sk]="values-sk"
  [uk]="values-uk"
)

for lang in "${!LOCALES[@]}"; do
  dir="$RES/${LOCALES[$lang]}"
  mkdir -p "$dir"
  curl -fsSL "$API/language/$lang?apikey=$KEY&format=android" -o "$dir/strings.xml"
done

Wire it into Gradle with a tasks.register("pullStrings", Exec) task that runs before preBuild, or call it from CI before ./gradlew assembleRelease.

Keeping keys Android-friendly

Android name attributes must match [a-zA-Z_][a-zA-Z0-9_]*. When you create keys in Localize.to, stick to lowercase + underscores (sign_in, welcome_message) and you'll never have to rename anything downstream. Dots are allowed in Localize.to keys but are not valid in Android resource names — avoid them if you plan to ship to Android.

Using the strings in your app

// Kotlin
val label: String = getString(R.string.sign_in)
val greeting: String = getString(R.string.welcome, userName)
<!-- XML layout -->
<TextView
    android:id="@+id/sign_in_button"
    android:text="@string/sign_in" />

Other formats

If you need the same strings somewhere else — a backend, a marketing site, an iOS twin of the app — the same API serves json, ios, xcstrings, xml, csv and php. See the Developers page for a full walkthrough and the API page for the endpoint reference.

Next steps