Android: how to provide Italian translation? - android

In the below link the documentation mentions creating "res/values-fr/strings.xml" for French translations and "res/values-ja/strings.xml" for Japanese translations. However, I couldn't find a list of all the acceptable path formats for all languages. I assume Italian would be "res/values-it/strings.xml", but it would be great if someone knew where this is documented.
http://developer.android.com/guide/topics/resources/localization.html

I assume Italian would be "res/values-it/strings.xml"
Yes, it is. The resource system uses the ISO3166-1 two letter country codes. See TelephonyManager.

Taken from Android docs:
The language codes are two-letter lowercase ISO language codes (such as "en") as defined by ISO 639-1. The country codes are two-letter uppercase ISO country codes (such as "US") as defined by ISO 3166-1.

Related

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.

Localizing the two-letter ISO country codes?

Localizing country names can be done with new Locale("", iso).getDisplayName() but is there a way of localizing ISO codes themselves? In my widget I'm using those to represent various countries. It seems wrong for a language - say, Arabic - to have countries be represented by the two letter ISO code from another alphabet. What are my options here?
By definition, ISO country codes are fixed strings of characters. Their very idea is that they are internationalized, independent of language. They provide the basis for transmitting information about a country in a standardized, language-neutral way; this information can then be displayed in a localized format, but localizing the code would fight against its very purpose.
ISO country codes are meant to be used in machine-readable data, in communication between programs and systems. They are not meant to be displayed to users, though for various reasons, they might be seen by them. Localizing them would still be a wrong move; the correct fix is to change the software that passes them through instead of proper localization.

Android: Get the device interface language in ISO 639 3-letters format?

I am developing an Android application for the global market, which will (hopefully!) be installed by users speaking different languages.
Since I want to adjust my interface language to the device's language, I need to acquire that language name in a convenient, standard format - preferably, ISO 639-2 3-letter format in which Hebrew is heb, English is eng and Spanish is spa.
How can I get the Android interface language in ISO 639-2 3-letter format?
You can use this code snippet:
protected static String lang = Locale.getDefault().getISO3Language();//.substring(0, 2);
I use the 2 chars variant, but I cut that part out, to leave you the 3 chars variant, as required.
List of ISO codes for languages
As you can see, substring the ISO 639-3 (3 letters) code does not make always the ISO 639-1 (2 letters) code.
Also I do not recommend this. Choose a hashtable to get the corresponding code.

What is the country code for Estonia on android phone

What is the country code for Estonia on an Android phone ?
For example French (France) is fr_FR
and Danish (Denmark) is da_DK
I opened a thread on Google Support but but nobody has replied yet.
Google Support: What is the country code for estonia on Android?
Citing Providing Resources from the dev guide:
The language is defined by 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").
http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
ESTONIA EE
http://www.loc.gov/standards/iso639-2/php/code_list.php
Estonian et
I would go with et_EE but I'm not 100% sure.
http://developer.android.com/reference/java/util/Locale.html
There is not a predefined constant for Estonia
however
Being that they are based off the ISO standards XX__XX lowercase xx for language and upercase XX for country,
which come from the ISO lists:
http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
and
http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
respectively
it would be something like et_EE for Estonian in Estonia

Localization Android

What languages are supported by android for localization with their respective values folder name, the best link i could find was http://developer.android.com/reference/java/util/Locale.html
any body can help me with more languages what if we need to support more languages then listed above.
My app uses the following undocumented languages, and they work:
ca Catalan
el Greek
es Spanish
pl Polish
pt Portuguese
ro Romanian
ru Russian
sv Swedish
More generally, it should be the string in the "639-1" column of this table.
I suggest use the list of the ISO 639-1 standard
Virtually any language defined by the Strings representing the language code (as specified by ISO 639-1) and (optionally) country (as defined by Alpha 2 representation of ISO 3166-1). You can specify only the language (i.e. "en") or the language used specifically in one area (i.e. "en","US"). You do not need to use the constants (though convenient) that come with Locale.
// This is to get spanish locale of Spain
Locale spanish = new Locale("es", "ES");
The problem is not only specifying the correct languages, but also assuring that the mobile phone supports literals/formatting for the indicated Locale. I.e. a mobile phone sold in Spain will support "es" and "es_ES", almost surely "en" and "en_US" too and probably "ca_ES", "ba_ES" and "gl_ES". It is not likely that it will support for example "es_AR" or "zh_CN". So I think that the answer to your question is "it depends on the market of your application".

Categories

Resources