简体   繁体   中英

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. 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; the resources are bundled within the APK itself and you should put localised strings in a localised values folder within the res/ folder. 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). 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. 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 . The former will be used on all devices that are set to Cymraeg, regardless of the country they're set to; 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 ).

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM