Skip to content Skip to sidebar Skip to footer

Internationalisation In Android

I am making an app in which I want to implement internationalization. I have created alternative resources like res/values-fr/strings.xml which Contains French text for all the

Solution 1:

You should always have default strings in res/values/strings.xml, because Android tries to use the most specific resource available. If you have for example res/values-fr/strings.xml and res/values-de/strings.xml and the users phone is set to English, your app will crash because neither de nor fr are applicable for English there are no fallback resources.

After you have specified your default strings and any translations in their respective subfolders, you can use the strings by their qualifiers. For example R.string.some_string. Android will then use the most appropriate translation that is available for the users current device language.

All that and more is explained here: Localizing with Resources

Solution 2:

Device will load locale automatically based on system languge. No extra steps required unless you want to change locale in your app independently.

Post a Comment for "Internationalisation In Android"