[loc-en-dev] Conclusion of ja_JP_JP/th_TH_TH problem

Doug Felt dougfelt at google.com
Wed Jul 28 16:10:36 PDT 2010


On Tue, Jul 27, 2010 at 3:16 PM, Doug Felt <dougfelt at google.com> wrote:

> 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
>>
>
Ignoring script?  Or must script be empty?


>
>> 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
>>
>> So I'm assuming  Locale.forLanguageTag("ja-JP-u-nu-thai-x-lvariant-JP") ->
ja_JP_JP-u-nu-thai

 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/20100728/39f53267/attachment.html 


More information about the locale-enhancement-dev mailing list