Resolve the applied locale back onto a shipped tag
The per-app-language store re-parses the applied locale through ICU and fills in the implied script, so a zh-CN choice reads back as zh-Hans-CN and no longer matches the tag the picker offers — the selected row lost its mark after a restart. currentTag(supported) maps it back.
This commit is contained in:
1 parent
05c79f2afc
commit
c6071239ce
3 files changed
+72
-2
No files matched your search
@@ -122,10 +122,11 @@ fun LanguagePickerRow(
|
||||
leading: @Composable () -> Unit,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
var current by remember { mutableStateOf(AppLanguage.currentTag()) }
|
||||
val supported = remember { AppLanguage.supportedTags(context, localesConfig) }
|
||||
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<String?>(null) + AppLanguage.supportedTags(context, localesConfig) }
|
||||
val options = remember(supported) { listOf<String?>(null) + supported }
|
||||
val label: (String?) -> String = { tag -> tag?.let { AppLanguage.displayName(it) } ?: autoLabel }
|
||||
|
||||
GroupedRow(
|
||||
|
||||
Reference in new issue
Block a user