Device manufacturers set what locale each device is set to for the country where the device is sold.
Users can change the language displayed on a device in menu:
Settings > Language & Keyboard > Select Language
or (depending on the device):
Settings > Locale and text > Select Locale
which presents for user selection languages by their native name.
Device manufacturers choose what locales the OS can support on each device.
TIP: Android sorts locales first by English characters, then special characters. This provides a cross-reference.
Language (English Name) | Country (English Name) | Dialing Code | MCC Code | Android Support Since Version | Folder with qualifier | Native Language Name | CONSTANT |
---|---|---|---|---|---|---|---|
Afrikaans | South Africa | +27 | 655 | - | values-af_rZA | Afrikaans | - |
Indonesian | Indonesia | - | - | 2.3 | values-id_rID | Bahasa indonesia | - |
Catalan | Spain | +34 | 214 | 2.3 | values-ca_rES | Català | - |
Czech | Czech Republic | - | - | 1.5 | values-cs_rCZ | čeština | - |
Danish | Denmark | +45 | 238 | 2.3 | values-da_rDK | Dansk | - |
German | Austria | - | - | 1.5 | values-de_rAT | Deutsch (Österreich) | - |
German | Germany | - | - | 1.1 | values-de_rDE | Deutsch | GERMANY |
German | Liechtenstein | - | - | 1.5 | values-de_rLI | Deutsch (Liechtenstein) | - |
German | Switzerland | - | - | 1.5 | values-de_rCH | Deutsch (Schweiz) | - |
English | Australia | +61 | 505 | 1.5 | values-en_rAU | English (Australia) | - |
English | UK/Britain | +44 | 234,235 | 1.5 | values-en_rGB | English (UK) | UK |
English | Canada | +1 | 302 | 1.5 | values-en_rCA | English (Canada) | CANADA |
English | India | +91 | 404,405 | 2.3 | values-en_rIN | English (India) | - |
English | Ireland | +353 | 272 | 2.3 | values-en_rIE | English (Ireland) | - |
English | New Zealand | +64 | 530 | 1.5 | values-en_rNZ | English (New Zealand) | - |
English | Singapore | +421 | 525 | 1.5 | values-en_rSG | English (Singapore) | - |
English | US | +1 | 310,311,316 | 1.1 | values-en_rUS | English (United States) | US |
English | Zimbabwe | +263 | 648 | 2.3 | values-en_rZA | English (Zimbabwe) | - |
Spanish | Spain | - | - | 1.5 | values-es_rES | Español (España) | - |
Spanish | US | - | - | 2.3 | values-es_rUS | Español (Estados Unidos) | - |
French | Belgium | - | - | 1.5 | values-fr_rBE | Français | - |
French | Canada | - | - | 1.5 | values-fr_rCA | Français | CANADA_FRENCH |
French | France | - | - | 1.5 | values-fr_rFR | Français | FRANCE |
French | Switzerland | - | - | 1.5 | values-fr_rCH | Français | - |
Croatian | Croatia | +385 | 219 | 2.3 | values-hr_rHR | Hrvatski | - |
Italian | Italy | - | - | 1.5 | values-it_rIT | Italiano | ITALY |
Italian | Switzerland | - | - | 1.5 | values-it_rCH | Italiano | - |
Latvian | Latvia | - | - | 2.3 | values-lv_rLV | Latviešu | - |
Lithuanian | Lithuania | - | - | 2.3 | values-lt_rLT | Lietuvių | - |
Hungarian | Hungary | - | - | 2.3 | values-hu_rHU | Magyar | - |
Dutch | Belgium | +32 | 206 | 1.5 | values-nl_rBE | Nederlands | - |
Dutch | Netherlands | +31 | 204 | 1.5 | values-nl_rNL | Nederlands | - |
Norwegian-Bokmol | Norway | - | - | 2.3 | values-nb_rNO | Norsk bokmål | - |
Polish | Poland | - | - | 1.5 | values-pl_rPL | Polski | - |
Portuguese | Brazil | - | - | 2.3 | values-pt_rBR | Português Brasileiro | - |
Portuguese | Portugal | - | - | 2.3 | values-pt_rPT | Português (Portugal) | - |
Romanian | Romania | - | - | 2.3 | values-ro_rRO | Română | - |
Slovak | Slovakia | - | - | 2.3 | values-sk_rSK | Slovenčina | - |
Slovenian | Slovenia | - | - | 2.3 | values-sl_rSI | Slovenščina | - |
Finnish | Finland | +358 | 244 | 2.3 | values-fi_rFI | Suomi | - |
Swedish | Sweden | - | - | 2.3 | values-sv_rSE | Svenska | - |
Vietnamese | Vietnam | +84 | 452 | 2.3 | values-vi_rVN | Tiếng Việt | - |
Turkish | Turkey | - | - | 2.3 | values-tr_rTR | Tϋrkçe | - |
Greek | Greece | - | - | 2.3 | values-el_rGR | Ελληνικά | - |
Bulgarian | Bulgaria | +359 | 284 | 2.3 | values-bg_rBG | Български | - |
Russian | Russia | - | - | 1.5 | values-ru_rRU | Pyccĸий | - |
Serbian | Serbia | - | - | 2.3 | values-sr_rRS | Српски | - |
Hebrew | Israel | - | - | 2.3 | values-he_rIL | עברית | - |
Persian | Iran | - | - | - | values-fa_rIR | فارسی | - |
Thai | Thailand | - | - | 2.3 | values-th_rTH | ภาษาไทย | - |
Korean | Korea | - | - | 1.5 | values-ko_rKR | 한국어 | KOREA |
Chinese | PRC | +86 | 460 | 1.5 | values-zh_rCN | 中文 | CHINA/SIMPLIFIED_CHINESE |
Chinese | Taiwan | +886 | 466 | 1.5 | values-zh_rTW | 繁體中文 | TRADITIONAL_CHINESE |
Japanese | Japan | - | - | 1.5 | values-ja_rJP | 日本語 | JAPAN |
Tagalog | Philippines | - | - | 2.3 | values-tl_rPH | wikang tagalog | - |
Ukrainian | Ukraine | - | - | 2.3 | values-uk_rUA | Українська | - |
- | Afganistan | +93 | 412 | - | - | - | - |
Albanian | Albania | +355 | 276 | - | - | - | - |
Arabic | Egypt | +20 | 602 | 2.3 | values-ar_rEG | العربية | - |
Arabic | Israel | +972 | 425 | 2.3 | values-ar_rIL | - | |
Hindi | India | - | - | 2.3 | values-hi_rIN | हिंदी | - |
Icelandic | Iceland | - | - | - | values-is_rIS | Íslenska | - |
Irish | Ireland | - | - | - | values-ga_rIR | Gaeilge | - |
Swahili | (Africa) | - | - | - | values-sl_rSI | Kiswahili | - |
WARNING: Java uses several deprecated two-letter codes.
This rewriting happens even if you construct your own Locale object, not just for instances returned by the various lookup methods.
WARNING: Android selects localized folder name qualifiers according this priority order -- country MCC code first, then country, etc.
CAUTION: The "Country Code" in Eclipse is the 3-digit MCC (Mobile Country Code), defined in ITU E.212 ("Land Mobile Numbering Plan") at http://mcclist.com/ which also lists Mobile Network Codes (MNC) to specify the carrier. See WIKIPEDIA: List_of_mobile_country_codes
Also shown on the table are telephone calling codes from ITU-T recommendations E.123 and E.164,
also called IDD (International Direct Dialing) or ISD (International Subscriber Dialing) codes.
See
WIKIPEDIA: List_of_country_calling_codes
Examples are +1 (001) for the US, +91 for India, etc.
TOOL: Country flags.
Localization (contracted to L10N for the 10 characters between L and N) enables the translation of language text used in various locales.
Folders for other locales use ISO 639-1 language codes (such as "es" for Spanish) and ISO 3166-1-alpha-2 region codes (such as "MX" for Mexico).
The folder "values" is standard in every Android program. It is created automatically when the project is created.
DO THIS: For each additional language to be supported by the app:
DOWNLOAD: Sample Android app.
DOWNLOAD: Sample iPhone app.
This video describes the text below TIP: Within YouTube, click the red "CC" icon and "Translate Captions", then click on "English (Transcribed)" to your language, such as "Spanish".
It is not good practice to hard-code text in the main.xml file within the layout folder.
android:text="Hello"
In place of localized text in the programming logic code, specify a variable such as @string/hello_info.
Variables are associated with localized text within strings.xml files.
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">ICL Example</string> <string name="hello_info">Hola</string> <color name="White">#ffffff</color> </resources>
The language used in each strings.xml file is specified by the name of its Folder with Qualifiers section below.
The ADK in Eclipse provides a form to display strings.xml.
Use L10N tools in MOTODEV, right-click strings.xml and Open With ... > Other > Localization Files Editor that works like a spreadsheet and leverages Google Translate.
WEBSITE: Crowdin.net is used by many apps to crowd-source translation work.
See my notes on Internationalization and Localization
Resource string variable names are usually in English. However, developers can name strings in other languages.
CAUTION: Accented characters should not be used in string names.
CAUTION: Upper and lower case characters (H and h) are considered different characters.
TIP: Do not use generic string names such as "title_1". This makes the translator's job more difficult.
There can be many entries in a strings.xml file. So organize string definitions to make them easier to find.
TIP: Keep strings for the same object or view together. Name strings first with object or view name, then the usage as a suffix. Example:
TIP: Put an underline between view and usage so in the future I can use a program to parse field names programmatically.
TIP: Suffix string names with their intended usage using common naming conventions:
Usage Type | Description |
---|---|
button | Icon text |
edit | text entered by user |
hint | prompt for what is expected in a field |
msg | What appears in pop-up toasts |
info | Text providing information, not editable |
title | Text at top of view |
TIP:
Avoid including punctuation marks in resource string files.
The programmer may want to display sentences without end of sentence periods.
TIP:
Avoid exclaimation marks (!) in resource string files.
The programmer may want to control when an exclaimation mark is needed or not.
TIP:
Avoid ellipsis (...) in resource string files.
The programmer may prefer to use the special ellipsis character.
Internationalization is the process of designing applications so that they can be localized (adapted) to various languages and regions without engineering changes. The word is so long that it is commonly abbreviated to I18N by removing the 18 characters between the first character (I) and last character (n) of the word.
Android java.util.Locale object does not support custom locales using "java.text.spi" and "java.util.spi" even though Android makes use of the same localization libraries Java uses:
ice cream sandwich | ICU 4.6 | CLDR 1.9 | Unicode 6.0 |
gingerbread/honeycomb | ICU 4.4 | CLDR 1.8 | Unicode 5.2 |
froyo | ICU 4.2 | CLDR 1.7 | Unicode 5.1 |
cupcake/donut/eclair | ICU 3.8 | CLDR 1.5 | Unicode 5.0 |
Use of the ICU provides support for several calendars around the world in addition to the Gregorian, specifically lunar calendars (Chinese, Coptic, Ethiopic, Hebrew, Indian, Hijri/Islamic (civil), Hijri/Islamic (religious / astronomical), Japanese, Persian (not in ICU4J), Taiwan, Thai Buddhist).
To get an appropriate locale for the user of the device you're running on, use
getDefault().
To get a list of all the locales available on the device you're running on, use
getAvailableLocales().