[loc-en-dev] toLanguageTag problem

Yoshito Umaoka y.umaoka at gmail.com
Wed Jan 26 13:08:05 PST 2011


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


More information about the locale-enhancement-dev mailing list