In the example for internationalization at JavaFX 2 and Internationalization the locale passed is resolved as en_EN. Is it even a valid locale?
Asked
Active
Viewed 1.8k times
7
-
1en = language English, UK = country United Kingdom. Now England is not separately listed in java. You might however introduce a variant `en_UK_EN` for own translations for non-Scottish, non-Wales things like "jolly". Non found keys then default to the predefined en_UK. – Joop Eggen Jul 27 '15 at 11:59
-
1`en_GB` is correct language code, not `en_UK`! I had issues with `en_EN ` when localizing dates (date was not formatted as european date). – Piro Jul 06 '17 at 06:31
1 Answers
4
See Enabled Locales for java.util and java.text Functionality for a list of all supported locales by Oracle's JDK 8 and the JRE 8.
The language tag en-EN
is not listed.
That's because the string given as the country code ("EN") is not an assigned ISO 3166 alpha-2 country code (see Locale, "country (region)").
A list of all 2-letter country codes defined in ISO 3166 can be retrieved with Locale.getISOCountries()
.

Modus Tollens
- 5,083
- 3
- 38
- 46