[loc-en-dev] Locale.toString() with language and script/extension without country/variant
Yoshito Umaoka
y.umaoka at gmail.com
Thu Jan 27 18:47:22 PST 2011
While testing private use tags, I discovered one more issue in
Locale.toString().
Our design goal was to put script and extensions after variant. By doing
so, they look like a part of variant from old Java releases. However, it
does not work well when a Locale has language and script/extensions, but
no country or variants.
For example:
Locale.forLanguageTag("en-Latn").toString() -> Expected: "en__#Latn" /
Actual: "en_#Latn"
Locale.forLanguageTag("en-x-123").toString() -> Expected: "en__#x-123" /
Actual: "en_#x-123"
The current behavior may confuse old Java programs assuming the second
field separated by "_" is country. I think we should also fix this
problem before JDK 7 final release.
-Yoshito
More information about the locale-enhancement-dev
mailing list