Installation
NOTE: For managing static translations, we recommend using Tolgee CLI.
Requirements
- Android API Level: 21+ (Android 5.0+)
Setup
Using Version Catalog is highly recommended to keep your versions aligned.
# gradle/libs.versions.toml
[libraries]
tolgee = { group = "io.tolgee.mobile-kotlin-sdk", name = "compose", version.ref = "tolgee" }
// build.gradle.kts (module)
dependencies {
implementation(libs.tolgee)
}
Create a network security config file network_security.xml
in your res/xml
folder:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config xmlns:android="http://schemas.android.com/apk/res/android">
<domain-config>
<domain includeSubdomains="true">tolgee.io</domain>
<domain includeSubdomains="true">tolg.ee</domain>
</domain-config>
</network-security-config>
Add network security config to your AndroidManifest.xml
:
<application
android:networkSecurityConfig="@xml/network_security"> <!-- Add this line to your existing application tag -->
</application>
Initialization
Initialize Tolgee in your Application class (Android). You can find your CDN URL prefix in the Tolgee Platform under your Project settings (CDN/Content Delivery). Use different prefixes per environment.
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Tolgee.init {
contentDelivery {
url = "https://cdn.tolg.ee/your-cdn-url-prefix" // e.g., from Tolgee Platform
storage = TolgeeStorageProviderAndroid(this@MyApplication, BuildConfig.VERSION_CODE) // cache invalidates on app update
}
}
}
}
TIP: Compose uses its own
stringResource
/pluralStringResource
helpers, noContextWrapper
needed.
Next steps
- Learn how to compose translations:
Usage
- Problems? See
Troubleshooting