[英]Support for Welsh language in IntelliJ IDEA for an Android app
From a question received privately: 从私下收到的问题中:
I'm currently creating an Android app and one of the requirements is that it supports a second language. 我目前正在创建一个Android应用,其中一项要求是它支持第二种语言。 I've Googled the language codes but I'm not finding the one that I need; 我已经搜索了语言代码,但找不到所需的代码; could you tell me if you support the Welsh language, which is a place in the United Kingdom? 你能告诉我你是否支持威尔士语,这是英国的一个地方? And if so, what is the country code for it? 如果是这样,国家代码是什么?
That would be on Android's side, not on the IDE side, to support; 支持将在Android方面,而不是IDE方面。 the resources are bundled within the APK itself and you should put localised strings in a localised values
folder within the res/
folder. 资源会捆绑在APK本身内,您应该将本地化的字符串放在res/
文件夹中的本地化values
文件夹中。 For example: 例如:
res/
values/ # Default locale (e.g., American English)
values-en-rGB/ # British English
values-it/ # Italian (any country)
In general, localisations on Android are defined as a two-letter ISO 639-1 language code, optionally followed by a two letter ISO 3166-1-alpha-2 region code (preceded by lowercase r). 通常,Android上的本地化定义为两个字母的ISO 639-1语言代码,还可以选择后面跟两个字母的ISO 3166-1-alpha-2区域代码(以小写字母r开头)。 Wales is not an independent country, but is part of Great Britain, and as such there is no ISO code for Wales as a region. 威尔士不是一个独立的国家,而是英国的一部分,因此,没有威尔士地区的ISO代码。 But, there is a Welsh language code! 但是,这里有威尔士语言代码! So you should be able to localise your app by putting your Welsh strings in the res/values-cy
or res/values-cy-rGB
. 因此,您应该可以通过将威尔士字符串放入res/values-cy
或res/values-cy-rGB
来本地化应用程序。 The former will be used on all devices that are set to Cymraeg, regardless of the country they're set to; 前者将在设置为Cymraeg的所有设备上使用,无论它们设置在哪个国家/地区。 the latter is specific to devices in Welsh with the country set to Great Britain. 后者专门针对威尔士的设备(该国家/地区设置为英国)。 For Welsh, the two things are essentially the same, since there aren't variations of it outside the UK, but this mechanism can be used for example to differentiate Traditional Chinese ( zh-rTW
) from simplified Chinese ( zh-rCN
). 对于威尔士语来说,这两者本质上是相同的,因为在英国以外没有任何区别,但是该机制可以用于例如区分繁体中文( zh-rTW
)和简体中文( zh-rCN
)。
For more details on how localisation works on Android, I recommend referring to the Localisation guide on the Android Developers website: https://developer.android.com/guide/topics/resources/localization 有关本地化如何在Android上工作的更多详细信息,建议您参考Android开发者网站上的本地化指南: https : //developer.android.com/guide/topics/resources/localization
For the list of supported ISO languages and countries, you can refer to the Wikipedia: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for the countries, and https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes for the languages. 有关受支持的ISO语言和国家/地区的列表,请参阅Wikipedia: https : //en.wikipedia.org/wiki/ISO_3166-1_alpha-2 (有关国家/地区)和https://en.wikipedia.org/wiki / List_of_ISO_639-1_codes用于这些语言。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.