![]() | |
|
A java.util.Locale
consists of three parts:
The language (mandatory, only lower case letter)
The language code is either two or three lowercase letters that conform to the ISO 639 standard.
Examples:
de
- German
en
- English
fr
- French
es
- Spanish
be
- Belarusian
The country (optional, only capital letters)
The region (country) code consists of either two or three uppercase letters that conform to the ISO 3166 standard, or three numbers that conform to the UN M.49 standard.
Examples:
US
- United States
CA
- Canada
DE
- Germany
FR
- France
ES
- Spain
BY
- Belarus
The variant, often used for a dialect (optional, only capital letters)
It is very common to use only the language part. Sometimes it is handy to add the country part. The variant is almost never used.
The idea behind this concept is that it is possible to build a system that implements a hierarchy of translations: common elements are defined in the languages, those that are country specific are defined on country level and finally messages that are even more specific use the variant part:
de
: contains the translations that are valid in all German speaking countries.
de_CH
contains translations that differ from the basic German translation, i.e. spellings and
expressions unique to Switzerland. So does de_DE
contain specific translation for German users.
![]() ![]() ![]() |