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.
This commit is contained in:
2026-08-11 18:08:44 +02:00
parent 52a5a66a93
commit 31ac3f616d
3 changed files with 12 additions and 3 deletions

View File

@@ -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 [bkrz](https://weblate.dev.jeanlucmakiola.de/user/bkrz/) for getting it
started; help finishing it is very welcome. 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 ## [2.19.0] — 2026-08-10
### Added ### Added

View File

@@ -302,13 +302,14 @@ private fun ReportProblemRow(position: Position) {
@Composable @Composable
private fun LanguageRow(position: Position) { private fun LanguageRow(position: Position) {
val context = LocalContext.current 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 // Setting a locale recreates the activity; mirror the choice locally so the
// row updates instantly even before the recreation lands. // 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) } var showDialog by remember { mutableStateOf(false) }
// null = follow the system; the rest are BCP-47 tags from locales_config.xml. // null = follow the system; the rest are BCP-47 tags from locales_config.xml.
val options = remember { listOf<String?>(null) + AppLanguage.supportedTags(context, R.xml.locales_config) } val options = remember(supported) { listOf<String?>(null) + supported }
GroupedRow( GroupedRow(
title = stringResource(R.string.settings_language), title = stringResource(R.string.settings_language),