[loc-en-dev] Conclusion of ja_JP_JP/th_TH_TH problem
Doug Felt
dougfelt at google.com
Tue Jul 27 15:16:52 PDT 2010
That's my understanding. Not sure if I captured all the details in the
docs, though.
Doug
On Mon, Jul 26, 2010 at 7:07 PM, Yoshito Umaoka <y.umaoka at gmail.com> wrote:
> Hi all,
>
> I think below is our conclusion for ja_JP_JP/th_TH_TH problem in the
> proposal. If you think I'm misunderstanding about this, please respond.
>
> 1. Constructor will add Unicode locale extension - u-ca-japanese /u-nu-thai
>
> new Locale("ja", "JP", "JP").getUnicodeLocaleType("ca") -> "japanese"
> new Locale("th", "TH', "TH").getUnicodeLocaleType("nu") -> "thai"
>
> 2. Serialization
>
> - writeObject writes out eveything into data stream
> - readObject read everything into Locale fields + special handling for
> ja_JP_JP/th_TH_TH. If language/country/variant is exactly "ja"/"JP"/"JP" or
> "th"/"TH"/"TH" and if the serialized Locale object does not have any
> extensions, then add the locale extension "u-ca-japanese" / "u-nu-thai" in
> readObject.
>
> 3. toLanguageTag() writes the variant as x-lvariant-xxx
>
> new Locale("ja", "JP", "JP").toLanguageTag() ->
> "ja-JP-u-ca-japanese-x-lvariant-JP"
> new Locale("th", "TH", "TH").toLanguageTag() ->
> "th-TH-u-nu-thai-x-lvariant-TH"
>
> 4. forLanguageTag(String)
>
> - Restore -x-lvariant to Locale's variant always, which may result variant
> JP/TH.
> - After processing -x-lvariant-xxxx, language/country/variant are exactly
> ja/JP/JP or th/TH/TH and no extensions, u-ca-japanese/u-nu-thai will be
> appended
>
> Note: With this proposal, Java will never create a Locale ja_JP_JP /
> th_TH_TH without extensions. Although, forLanguageTag may create a Locale
> ja_JP_JP with other extensions. For example:
>
> Locale.forLanguageTag("ja-JP-u-ca-gregory-x-lvariant-JP") -> ja_JP_JP with
> extension u-ca-gregory
>
> 5. Builder.setLocale(Locale)
>
> - setLocale accepts Locale("ja", "JP", "JP") / Locale("th", "TH", "TH"),
> but the ill-formed variant is dropped.
>
> new Builder().setLocale(new Locale("ja", "JP", "JP")).build().toString() ->
> "ja_JP_#u-ca-japanese" (Note: extension u-ca-japanese is appended by the
> Locale constructor)
>
>
> -Yoshito
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/locale-enhancement-dev/attachments/20100727/19455ad8/attachment.html
More information about the locale-enhancement-dev
mailing list