Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How were the Locale constants chosen?

Tags:

java

locale

The Java class java.util.Locale has a set of public static final fields for languages/countries for direct references to specific locales. Other locales can easily be used via the appropriate constructors.

However, the selection of values seems rather arbitrary to me.

The languages are (in the order in which they appear in the source): English, French, German, Italian, Japanese, Korean, Chinese, Simplified Chinese, Traditional Chinese

The countries are: France, Germany, Italy, Japan, Korea, China, PRC, Taiwan, UK, US, Canda and Canada French (for the locale fr_CA).

Does anyone have an idea (or even a guess) how those languages/countries where chosen?

like image 335
Joachim Sauer Avatar asked Apr 11 '11 13:04

Joachim Sauer


People also ask

How many locales are there?

Edit: The original list of locales has been edited to add additional locales that were not included before. Now 228 listed. The most important thing for various versions of English is in formatting numbers and dates.

What is locale specific?

A locale consists of a number of categories for which country-dependent formatting or other specifications exist. A program's locale defines its code sets, date and time formatting conventions, monetary conventions, decimal formatting conventions, and collation (sort) order.

How does locale work in Java?

A Locale object represents a specific geographical, political, or cultural region. An operation that requires a Locale to perform its task is called locale-sensitive and uses the Locale to tailor information for the user.


2 Answers

Those codes are defined by ISO standards 3166 for country codes and 639 for language codes. See also the W3C Internationalization Activity page.

Edit:

Re-reading the question, the OP already knew this :-)

According to the Sun article Internationalization: Understanding Locale in the Java Platform those values are chosen as examples and it even tells us:

Because so few premade locales exist, you should probably just avoid these static objects altogether.

like image 179
rsp Avatar answered Nov 08 '22 09:11

rsp


I'd guess it's simply the most often used locales as a convenience for developers.

From the Javadoc:

The Locale class provides a number of convenient constants that you can use to create Locale objects for commonly used locales.

like image 37
Thomas Avatar answered Nov 08 '22 10:11

Thomas