#15128 closed bug (notabug)
datepicker default localisation chinese
Reported by: | claudi | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | none |
Component: | ui.datepicker | Version: | 1.12.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If you set an invalid locale to datepicker, it switches to chinese language. I.e. $.datepicker.setDefaults($.datepicker.regionalxy?); Wouldn't it be better to take "en" as default, if an invalid locale is given? I currently have to do this manually.
Change History (2)
comment:1 Changed 6 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
comment:2 Changed 6 years ago by
Thanks for the explanation. I think it's ok to use the workaround checking for undefined. I was always wondering about getting chinese so nice to know the reason for this ;)
Note: See
TracTickets for help on using
tickets.
Let me explain what's happening. You are not setting an invalid locale, you are passing
undefined
tosetDefaults()
.setDefaults()
does not accept a locale, it accepts an object containing settings which should become the new defaults. When you use an invalid locale, you're indexing into$.datepicker.regional
on a key that doesn't exist and getting backundefined
. You're then passingundefined
tosetDefaults()
which does nothing. The only reason you'd be getting Chinese at that point is because the defaults are already set to Chinese before this call. Keep in mind that every locale file you load changes the defaults.