[loc-en-dev] Error handling in LocaleBuilder and forLanguageTag

Yoshito Umaoka y.umaoka at gmail.com
Thu Mar 5 10:40:10 PST 2009


Naoto Sato wrote:
> Folks,
>
> I have two comments as follows:
>
> - Locale.forLanguageTag(): Please describe how the lenient behavior 
> works in the spec.  This should not be implementation dependent.

     * Returns a locale for the specified language tag string.  If the
     * specified language tag contains any non-well-formed subtags, the 
first
     * such subtag and all following subtags are ignored.

This is the current JavaDoc description.  I think we'll just refer BCP47 
for subtag validation.  Or, put the current BCP47 langtag BNF here.  I 
actually think we should update the API doc for Locale class and explain 
the relationship with BCP47 language tag / what is 
well-formed/ill-formed and etc.

>
> - What happens with Builder.setLanguageTag(), if some other setXXX()s 
> are previously called and they conflict?  Are they reset strictly to 
> setLanguageTag(), or superset tag is created, or an exception?
Builder#setLocale and setLanguageTag will overwrite all fields.  For 
example,

new Builder().setRegion("US").setLanguageTag("en").create()

will return Locale en, not en_US.

-Yoshito



More information about the locale-enhancement-dev mailing list