Android-library module, drawn from the byte-identical AppLanguage in Agendula and Calendula: read the shipped languages from res/xml/locales_config.xml, get/set the applied language via AppCompatDelegate, and render each language's autonym. The locales_config resource id is now a parameter, so the module is app-agnostic. appcompat only, no Compose. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
47 lines
1.2 KiB
Kotlin
47 lines
1.2 KiB
Kotlin
// core-locale — per-app language plumbing shared across the family: read the
|
|
// shipped languages from res/xml/locales_config.xml, get/set the applied
|
|
// language via AppCompatDelegate, and render each language's autonym. App-
|
|
// agnostic — the consuming app passes its own locales_config resource id; no
|
|
// Compose, no DataStore.
|
|
plugins {
|
|
alias(libs.plugins.android.library)
|
|
}
|
|
|
|
android {
|
|
namespace = "de.jeanlucmakiola.floret.locale"
|
|
compileSdk = 37
|
|
|
|
defaultConfig {
|
|
minSdk = 29
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
testOptions {
|
|
unitTests {
|
|
all { it.useJUnitPlatform() }
|
|
isReturnDefaultValues = true
|
|
}
|
|
}
|
|
}
|
|
|
|
kotlin {
|
|
compilerOptions {
|
|
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
// appcompat brings AppCompatDelegate plus its core (LocaleListCompat) and
|
|
// annotation (XmlRes) transitives.
|
|
implementation(libs.androidx.appcompat)
|
|
|
|
testImplementation(libs.junit.jupiter.api)
|
|
testRuntimeOnly(libs.junit.jupiter.engine)
|
|
testRuntimeOnly(libs.junit.platform.launcher)
|
|
testImplementation(libs.truth)
|
|
}
|