3

If i read the Javadocs for Locale, i see that exists a constant UK for United Kingdom (i think :P)

But if i read the class documentation, it says:

The country argument is a valid ISO Country Code. These codes are the upper-case, two-letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as: http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html

But, in the ISO 3166 the two letters code for United Kingdom is GB

So, why the countryId for the Locale in United Kingdom is UK? What iso is used to the countryId of the Locale object?

Stu Thompson
  • 38,370
  • 19
  • 110
  • 156
nacho
  • 31
  • 1

2 Answers2

1

It's indeed ISO 3166. The constant java.util.Locale.UK has the value "en_GB". So despite it being called UK, it has the right value.

Martin v. Löwis
  • 124,830
  • 17
  • 198
  • 235
1

Actually the java.util.Locale.UK is a static constant indeed representing the United Kingdom. The ISO country code used by the Locale instance of this constant is however "GB", as the ISO 3166 states. Note by the way that there is also a so called ISO country code reservation for "UK" (see also Wikipedia for this). Why they named the static locale constant "UK" and not "GB" is something I can only guess for, but most likely because people are more used to "UK" instead of "GB", though the latter is of course the ISO standard.

Tim
  • 831
  • 7
  • 7