On 8/10/2009 11:46 AM, Yoshito Umaoka wrote:
Sorry for slow response.  I was taking a vacation.

No problem.


Let me ask another question. If you do:

Locale locale = new Locale.Builder().setLanguage("es").setRegion("ES").setVariant("Traditional_WIN").create();
System.out.println(locale.getVariant());

what will that produce? ("Traditional_WIN" is an example from the Locale API doc.)

The idea is to throw an exception for variant "Traditional_WIN" and clearly document that builder only accept variant value(s) which satisfy the BCP47 variant syntax.

What if someone wants to use ISO Language Code "he" without making changes to variant names? The current code might be:

 Locale locale = new Locale("iw", "IL", "MyVariant");

Then, the user might want to change this one to:

 Locale locale = new 
Locale.Builder().setLanguage("he")....setVariant("MyVariant").create();

But if the new one throws an exception, the user needs to stay with "iw".

I think we need to have a separate variant to allow users to migrate from the constructor to the Locale.Builder without changing other things.

Thanks,
Masayoshi



-Yoshito

Reply via email to