globalize icon indicating copy to clipboard operation
globalize copied to clipboard

Globalize.culture( selector ) appears to work but does not set culture

Open yucca42 opened this issue 15 years ago • 1 comments

Trying to use Globalize.culture() with a parameter that is a valid code for country variant of a language, like "es-AO", seemingly works in the sense that the function returns a culture corresponding to the language generically, like "es":

alert(Globalize.culture("es-AO").name) shows "es".

But using format() with the culture defaulted, like

alert(Globalize.format(new Date(),"D"));

fails to use the "es" culture and uses "en" settings instead. For comparison, the operation with an explicit culture parameter works (Spanish date presentation appears):

alert(Globalize.format(new Date(),"D","es-AO"));

yucca42 avatar Jun 25 '11 20:06 yucca42

I have the same problem with a german locale:

>>> Globalize.culture("de-de")
Object { name="de", englishName="German", more...}
>>> Globalize.culture()
Object { name="en", englishName="English", more...}

The "setter" method Globalize.culture(locale) just returns the found locale, but doesn't set it as default for subsequent localisation operations.

I could reproduce this issue with the current master version of Globalize. I'm wondering why yucca42's ticket from June is still without feedback, since this is a severe error in the Globalize API.

fbuchinger avatar Sep 27 '11 14:09 fbuchinger