[loc-en-dev] Fwd: toLanguageTag problem

Yoshito Umaoka y.umaoka at gmail.com
Wed Jan 26 18:40:56 PST 2011


Hmm.. My original message had gone somewhere. Resending.

-------- Original Message --------
Subject: 	toLanguageTag problem
Date: 	Wed, 26 Jan 2011 16:08:05 -0500
From: 	Yoshito Umaoka <y.umaoka at gmail.com>
To: 	locale-enhancement-dev at openjdk.java.net



Hi all,

I found a problem in Locale#toLanguageTag(). When an instance of Locale
has no language, toLanguageTag() supplies "und" as the language subtag.
This is a requirement of "langtag" construction of BCP47 language tag.

  langtag       = language
                  ["-" script]
                  ["-" region]
                  *("-" variant)
                  *("-" extension)
                  ["-" privateuse]

However, it is not necessary if the Locale only has private use value.
Because a BCP47 language tag could be private use alone.

  Language-Tag  = langtag             ; normal language tags
                / privateuse          ; private use tag
                / grandfathered       ; grandfathered tags



For example,

Locale.forLanguageTag("x-elmer").toLanguageTag()

Above currently returns "und-x-elmer", but it should actually return
"x-elmer". I'm going to file a bug for this issue.

-Yoshito

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/locale-enhancement-dev/attachments/20110126/3c6d2487/attachment.html 


More information about the locale-enhancement-dev mailing list