How to translate Android strings.xml with AI — and keep it in sync
Copy-pasting strings.xml into a translation tool works once. After that, new keys drift, placeholders break
(%1$s vs %s), and plurals lose their few/many forms in languages like Romanian, Russian or Ukrainian.
This guide sets up a loop where Gradle keeps strings.xml in sync with Verba and AI does the first translation pass.
1. Apply the Gradle plugin
// app/build.gradle.kts
plugins { id("kred.verba.translations") version "1.0.3" }
translations { project = "my-app" }
# local.properties (not committed)
verbaToken=<read-token>
verbaWriteToken=<write-token>
2. Send your existing keys
./gradlew syncKeys
3. Translate with AI
In Verba, open the project and run Translate missing (Traduce lipsă). The AI receives the existing languages as context and fills
the missing ones. Placeholders are kept and numbered from the source text — if a language needs a different word
order, the translation becomes %2$s … %1$s, so getString(id, min, max) still puts each value in the right place.
Plurals are generated with the forms each language needs.
4. Build
./gradlew assembleDebug
fetchTranslations runs before every build and rewrites res/values-*/strings.xml only when something changed.
No network or no token? The build continues with the files you already have.
5. Update texts after release
VerbaOta.init(this)
val text = VerbaOta.get(lang, "checkout_pay") ?: getString(R.string.checkout_pay)
See the full Android reference.