Technically, when a user configures his language, a Java
is stored for this user. A locale
consists of three parts: de_CH_ZHLocale
The language : e.g. German, only lower case letter
Optional: the country : e.g. Switzerland, only capital letters
Optional: the variant : e.g. Zürich (often used for a dialect) only capital letters
Since Java checks for valid languages it is mandatory to only use language and country codes that actually exist:

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.