Apps SDK — Android
Translate your Android app's UI into 90 languages from Kotlin (or Java). The SDK caches translations on disk for instant offline startup and never throws into your app — every failure falls back to the original text.
Install
- Download the library: transable-android-0.1.0-preview.1.zip
- Copy
transable-sdk-release.aarfrom the zip into your app module'slibs/folder. - Wire it up in your app module
build.gradle.kts(the SDK has no transitive dependencies, so nothing else is needed):
repositories {
flatDir { dirs("libs") }
}
dependencies {
implementation(name = "transable-sdk-release", ext = "aar")
}
Then create an app project in the dashboard and copy your API key (it looks like tk_live_…).
One-line start
Initialize in Application.onCreate (or before your first UI is shown). It is idempotent and never throws:
import to.transable.sdk.Transable
import to.transable.sdk.TransableOptions
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
Transable.init(this, "tk_live_yourKeyHere", TransableOptions().apply {
appName = "myapp"
// defaultLanguage = "de" // optional — omit to auto-detect the device language
})
}
}
Translate text anywhere. t() is synchronous and non-blocking: it returns the cached translation if present, otherwise the fallback while it fetches in the background (the next call returns the translation, and onTranslationsUpdated() fires on the main thread):
button.text = Transable.t("save", "Save")
title.text = Transable.t("welcome", "Welcome")
Reacting to updates & switching language
Re-run your text binding when background translations land or when the language changes (both delivered on the main thread):
import to.transable.sdk.TransableListener
Transable.addListener(object : TransableListener {
override fun onTranslationsUpdated() = rebindAllTexts()
override fun onLanguageChanged(code: String) = rebindAllTexts()
})
// Transable.removeListener(listener) when your screen is destroyed.
Transable.setLanguage("fr") // persisted, restored next launch
Batch API for lists/menus you build in code (callback on the main thread; failed entries keep their source text):
Transable.translateBatch(listOf("New game", "Continue", "Options")) { translated ->
render(translated)
}
Safe mode & offline cache
Safe mode is on by default and runs before anything leaves the device: pure numbers, strings under 2 chars, emails, URLs, file paths, GUIDs, version numbers, log lines, and code-like identifiers (PascalCaseNames, SCREAMING_SNAKE) are never sent — while single words like "Save" translate normally. Never pass user input (EditText contents) to the SDK; safe mode cannot know what a human typed.
Every translation is cached on disk under {filesDir}/transable/v1/, per language, content-addressed (change one string, only that string is retranslated). The second launch is translated instantly — even fully offline.
It never crashes your app
One rule: no public method throws or blocks. Missing key, no network, HTTP 4xx/5xx, quota exhausted — the UI stays in the source language and translation retries quietly. Rate limits (429) honor Retry-After; a monthly-quota body goes silent until the next UTC day; an invalid key (401/402/403) disables translation for the session with a single log line.
Questions or something broke? Contact us — include your Android/AGP version and the SDK version. Other platforms: iOS / macOS, Flutter, or any language via the REST API. Full platform list on Apps SDK.