5.2.  Define what a locale represents


A java.util.Locale consists of three parts:

  1. The language (mandatory, only lower case letter)

    The language code is either two or three lowercase letters that conform to the ISO 639 standard.


    • de - German

    • en - English

    • fr - French

    • es - Spanish

    • be - Belarusian

  2. 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.


    • US - United States

    • CA - Canada

    • DE - Germany

    • FR - France

    • ES - Spain

    • BY - Belarus

  3. 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:

Professional hosting         Free 'Oracle Certified Expert Web Services Developer 6' Guide     Free SCDJWS 5.0 Guide