brabo-hi
02/12/2022, 9:37 PMval configuration = LocalConfiguration.current
configuration.setLocale(locale)
Doesn’t look to have any effect unless we add resources.updateConfiguration(configuration, resources.displayMetrics)
but this method looks deprecatedNathaniel Rowe
02/12/2022, 10:14 PMval configuration = LocalConfiguration.current
configuration.setLocale(locale)
CompositionLocalProvider(LocalConfiguration provides configuration) {
// everything here "sees" the updated configuration
}
This will only use the updated configuration for composables that are in that composition local provider. Everything outside will still see the normal configuration.
I think that method is deprecated because you really shouldn't be setting the configuration app-wide. If you want that updated locale for all of your stuff, then just make sure to include that composition local provider super high up in your composition hierarchy, so that everything in your app is "underneath" it.val updatedConfiguration = remember { configuration.setLocale(locale) }
. Sorry, I'm not super good with the whole "remember" concept.brabo-hi
02/13/2022, 1:53 AMval configuration = LocalConfiguration.current
configuration.setLocale(Locale.ITALIAN)
CompositionLocalProvider(LocalConfiguration provides configuration) {
Text(text = stringResource(id = R.string.label_phone))
}
Utkarsh Tiwari
02/09/2023, 8:34 AM