vinaygaba/Learn-Jetpack-Compose-By-Example

Please add an example of how to add localization with Jetpack compose

moinsam opened this issue · 4 comments

Please add an example of how to add localization with Jetpack compose

Localization in Compose is identical to how you would traditionally do it in Android. For example, if I want to localize my strings, I would create separate values folder based on the locale and then access the string using

val context = ContextAmbient.current
val string = context.getString(R.string.app_name)

Based on the locale set on your device, the correct string value will be picked.

@moinsam Was there anything else you were looking for?

@vinaygaba Thank you for your answer.

musso commented

@vinaygaba Can you show an example on how to load different locale dynamically, which didn't base on device setting?