Hello guys! Is it possible to change locale in com...
# compose
i
Hello guys! Is it possible to change locale in compose project without recreating Activity? I tried using:
Copy code
val appLocale: LocaleListCompat = LocaleListCompat.forLanguageTags("en")
AppCompatDelegate.setApplicationLocales(appLocale)
and inside AndroidManifest.xml:
Copy code
android:configChanges="locale|layoutDirection"
But still
LocalConfiguration.current.locales[0]
does not change until activity is recreated.
s
If you try with this
Copy code
@Composable
@ReadOnlyComposable
fun getLocale(): Locale {
  val configuration = LocalConfiguration.current
  return ConfigurationCompat.getLocales(configuration).get(0) ?: LocaleListCompat.getAdjustedDefault()[0]!!
}
Do you experience the same problem?
a