Android
Two artifacts work together:
- Gradle plugin
kred.verba.translations(Gradle Plugin Portal) — downloads translations and regeneratesstrings.xmlbefore every build; hooks intopreBuildautomatically. - Runtime
kred.verba:translations-runtime(Maven Central) — over-the-air updates inside the app. The plugin adds it for you.
1. Create tokens
In Verba: project → Settings (Setări) → Package keys (Chei pachete) → platform Android → generate a read token (required) and, optionally, a write token for pushing keys from code.
2. Apply the plugin — app/build.gradle.kts
plugins { id("kred.verba.translations") version "1.0.3" }
translations {
project = "your-project-slug"
// locales and folders come from Verba; optional: locales = listOf("en", "ro", "de")
}
3. Tokens — local.properties (not committed)
verbaToken=<read-token>
verbaWriteToken=<write-token> # optional, for syncKeys
On CI use environment variables instead: VERBA_TOKEN and VERBA_WRITE_TOKEN.
4. Build
./gradlew assembleDebug
fetchTranslations runs before preBuild and writes res/values*/strings.xml. Without a token or network the
build continues with the existing files.
5. Over-the-air updates
VerbaOta.init(this) // Application.onCreate()
VerbaOta.get(lang, key) ?: getString(resId) // Verba first, compiled string as fallback
6. Push keys from code
./gradlew syncKeys
Creates in Verba the keys that exist only in your strings.xml (write token required).
Placeholders and plurals
Verba stores placeholders by name (Between {min} and {max}) and numbers them from the source language, so a
translation that swaps the order still gets the right argument (%2$s … %1$s). Plurals become <plurals> with
%d; a plural with other arguments uses %1$d for the count (%1$d days / %2$s).