开发者

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 strings, including title

Can anyone tell me what to do next...

thanks


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜