Convert this
LocaleCode instance to a
Locale instance.
In most cases, this method creates a new
Locale instance
every time it is called, but some
LocaleCode instances
return their corresponding entries in
Locale class.
For example,
#it always returns
Locale#ITALIAN.
The table below lists
LocaleCode entries whose
toLocale()does not create a new
Locale instance but returns an entry in
Locale class.
LocaleCode |
Locale |
LocaleCode#de |
Locale#GERMAN |
LocaleCode#en |
Locale#ENGLISH |
LocaleCode#fr |
Locale#FRENCH |
LocaleCode#fr_CA |
Locale#CANADA_FRENCH |
LocaleCode#it |
Locale#ITALIAN |
LocaleCode#ja |
Locale#JAPANESE |
LocaleCode#ko |
Locale#KOREAN |
LocaleCode#zh |
Locale#CHINESE |
LocaleCode#zh_CN |
Locale#SIMPLIFIED_CHINESE |
LocaleCode#zh_TW |
Locale#TRADITIONAL_CHINESE |
In addition,
toLocale() of
LocaleCode#undefined behaves a bit differently. It returns
Locale#ROOT when it is available (i.e. when
the version of Java SE is 1.6 or higher). Otherwise, it returns
a
Locale instance whose language and country are empty
strings. Even in the latter case, the same instance is returned
on every call.