Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datepicker Widget Utility functions: $.datepicker.regional[ "fr" ] is not defined by default #275

Open
Chealer opened this issue Jul 23, 2015 · 3 comments

Comments

@Chealer
Copy link

Chealer commented Jul 23, 2015

http://api.jqueryui.com/datepicker/ contains the following code example:

Set all date pickers to have French text.
1 $.datepicker.setDefaults( $.datepicker.regional[ "fr" ] );

In reality, this only works if $.datepicker.regional[ "fr" ] is defined, and defined to contain French texts. As explained in the Localization section (below), this typically involves loading an extra JS file.

Note that the files on jQuery's GitHub already call setDefaults, so for a French-only website, that call would be unneeded.

Also, the description is misleading; $.datepicker.regional[ "fr" ] contains options not limited to labels. For example, it sets dateFormat. I recommend either clarifying the effect or removing this example.

By the way, I wonder whether the Localization section shouldn't be above the Utility functions section, since by default, the widget is difficult to use unless all of the audience understands English.

@scottgonzalez
Copy link
Member

Are you suggesting that we add a note that you must load the locale first? It's not entirely clear exactly what change you're looking for.

@Chealer
Copy link
Author

Chealer commented Jul 23, 2015

Hi Scott,
I am also not entirely clear on what exactly should be done myself. What is important is to make sure the reader does not believe the call will necessarily localize to French, and I will consider this ticket as solved no matter which solution addresses that. This could indeed be adressed by adding a note, or simply by removing the example.

I think treating $.datepicker.setDefaults( $.datepicker.regional[ foo ] ); is important. But this should probably be done in the Localization section. It is in fact almost done there already.

There is a cost to keeping the example, even in a non-misleading form. $.datepicker.regional is never defined. For a relatively inexperienced user like me, the call is puzzling - it is not clear that $.datepicker.regional[ foo ] corresponds to $options.

So, at least with a small adaptation of the Localization section, I believe the best solution is removal.

@valugi
Copy link

valugi commented Oct 19, 2018

I agree with @Chealer . Localisation should a first citizen in the option list and not require any other js loading. The calendar should come with a default option en_US and users should be able to change on the fly the locale as any other option within the options set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants