Skip to content

Instantly share code, notes, and snippets.

@V-Abhilash-1999
Created October 30, 2023 16:18
Show Gist options
  • Save V-Abhilash-1999/e84547b85302a331d94d9cb94b36df42 to your computer and use it in GitHub Desktop.
Save V-Abhilash-1999/e84547b85302a331d94d9cb94b36df42 to your computer and use it in GitHub Desktop.
val context = LocalContext.current
val newContext = remember(locale) {
val res = context.resources
val conf = res.configuration
conf.setLocale(locale)
context.createConfigurationContext(conf)
}
val okText = remember(newContext) {
newContext.resources.getString(android.R.string.ok)
}
val cancelText = remember(newContext) {
newContext.resources.getString(android.R.string.cancel)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment