From 31ac3f616d5fbcbd1c7d8485af0d24858386d9b6 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Tue, 11 Aug 2026 18:08:44 +0200 Subject: [PATCH] Keep the language picker's selection marked Bumps floret-kit to ad440e8, whose AppLanguage.currentTag(supported) maps the platform's normalised locale tag back onto the shipped one. --- CHANGELOG.md | 8 ++++++++ .../calendula/ui/settings/SettingsScreen.kt | 5 +++-- floret-kit | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76d335e..399b5d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [bkrz](https://weblate.dev.jeanlucmakiola.de/user/bkrz/) for getting it started; help finishing it is very welcome. +### Fixed +- **The language picker forgot which language was picked.** Android hands the + applied language back with its script filled in — Simplified Chinese goes in + as `zh-CN` and comes out as `zh-Hans-CN` — so after a restart no entry in + Settings → Language showed as selected, and the row above it named the + language the long way round. Only languages that imply a script were + affected. + ## [2.19.0] — 2026-08-10 ### Added diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/SettingsScreen.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/SettingsScreen.kt index 5894d9d..b000e70 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/SettingsScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/SettingsScreen.kt @@ -302,13 +302,14 @@ private fun ReportProblemRow(position: Position) { @Composable private fun LanguageRow(position: Position) { val context = LocalContext.current + val supported = remember { AppLanguage.supportedTags(context, R.xml.locales_config) } // Setting a locale recreates the activity; mirror the choice locally so the // row updates instantly even before the recreation lands. - var current by remember { mutableStateOf(AppLanguage.currentTag()) } + var current by remember { mutableStateOf(AppLanguage.currentTag(supported)) } var showDialog by remember { mutableStateOf(false) } // null = follow the system; the rest are BCP-47 tags from locales_config.xml. - val options = remember { listOf(null) + AppLanguage.supportedTags(context, R.xml.locales_config) } + val options = remember(supported) { listOf(null) + supported } GroupedRow( title = stringResource(R.string.settings_language), diff --git a/floret-kit b/floret-kit index 05c79f2..ad440e8 160000 --- a/floret-kit +++ b/floret-kit @@ -1 +1 @@ -Subproject commit 05c79f2afc489e9cab7f2d42cce6ba853cc1f430 +Subproject commit ad440e8cac3c54fad1cb7a897c00efe98eecde9a