国际android系统 [英] internationalisation in android
问题描述
我在做,我想实现国际化的应用程序。
我创建了替代资源,如
I am making an app in which I want to implement internationalization. I have created alternative resources like
RES /值-FR / strings.xml中
它包含了所有的字符串法国文本,包括标题
res/values-fr/strings.xml which Contains French text for all the strings, including title
谁能告诉我下一步该怎么做...
Can anyone tell me what to do next...
感谢
推荐答案
您应该始终有 RES /价值/ strings.xml中
,默认字符串由于Android尝试使用可用的最具体的资源。如果你有,例如<code> RES /值-FR / strings.xml中和 RES /值-DE / strings.xml中
和电话设置为英语的用户,您的应用程序会崩溃,因为无论德
也不 FR
英语适用有没有后备资源。
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.
您已经在各自的子文件夹指定默认的字符串和任何翻译后,你可以通过它们的限定词使用的字符串。例如 R.string.some_string
。那么Android将使用最适当的翻译,可用于用户当前设备的语言。
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
这篇关于国际android系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!