// core-locale — everything "what language are we in", shared across the family: // read the shipped languages from res/xml/locales_config.xml, get/set the applied // language via AppCompatDelegate, render each language's autonym, observe the // current locale from Compose, and format dates in that locale's own field order. // App-agnostic — the consuming app passes its own locales_config resource id; no // DataStore. // // Compose is here for currentLocale() alone: applying a language mid-process is // this module's own API, so the hook that makes the UI notice belongs beside it // rather than in a Compose module that would have to depend back on this one. // (core-crash is the precedent for a core-* module carrying Compose.) Deliberately // lean: runtime + ui only, no material3, no foundation. plugins { // AGP 9.x provides built-in Kotlin compilation, so only the Compose plugin is // applied alongside the Android library plugin. alias(libs.plugins.android.library) alias(libs.plugins.kotlin.compose) } android { namespace = "de.jeanlucmakiola.floret.locale" compileSdk = 37 defaultConfig { minSdk = 29 } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } buildFeatures { compose = true } 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) // ConfigurationCompat for currentLocale(). Reachable transitively via // appcompat, but declared because this module uses it directly. implementation(libs.androidx.core.ktx) // currentLocale() only needs the runtime (@Composable, remember) and ui // (LocalConfiguration) — api() so consumers can use the returned Locale in // their own composables without re-declaring Compose themselves. api(platform(libs.androidx.compose.bom)) implementation(libs.androidx.ui) testImplementation(libs.junit.jupiter.api) testRuntimeOnly(libs.junit.jupiter.engine) testRuntimeOnly(libs.junit.platform.launcher) testImplementation(libs.truth) }