I had a problem very similar to yours. What I've done to solve it was
to grab the minified version of jquery-ui-i18n and place it alongside
with jquery-ui-172, I just load the i18n after the jqueryUI itself and
then a code very similar to the one shown in the demo, and it works
correcty.

So, schematically, here it is

- load jquery
- load jquery ui
- load jquery ui i18n

then you do something like

$(function(){
   $.datepicker.setDefaults($.extend({showMonthAfterYear: false},
$.datepicker.regional['it']));
   $('.datepicker').datepicker();
}

and it gets localized correctly.

On 20 Nov, 12:16, smurkas <marcus.dalg...@gmail.com> wrote:
> Ok I have solved this but it was really messy.
> I include all my js in the footer so I don't use document.ready unless
> it's a really special case.
>
> However to get this to work I had to run the regionalization on
> document.ready otherwise it wouldn't work.
> For some reason $.datepicker.regional['sv'] returns undefined until
> document.ready even though jQuery UI is included first, then the i18n
> script and finally my implementation script.
> I tried logging it in my implementation script and I tried logging it
> in the i18n file but both returned undefined.
>
> Is this the way it's supposed to be or am I doing something wrong?
>
> On 20 Nov, 10:34, smurkas <marcus.dalg...@gmail.com> wrote:
>
> > Hello.
>
> > I've have been trying to localize my datepicker to Swedish. I looked
> > in the docs but there appears to be no documentation on it, just an
> > example which I can't get to work.
>
> > The rest of the documentation is excellent so it's abit strange that
> > almost nothing is written about how to localize the datepicker. The
> > documentation needs to explain where to put the i18n folder if it's
> > needed. Right now that folder is in the development bundle, ideally
> > that folder should be in js-folder as well since I think people often
> > just grab the minified version (I know I do) and have to go digging
> > for the i18n files.
>
> > I put the i18n folder in my js-folder but I'm still having no luck. I
> > included the Swedish i18n-file and when looking at the code it appears
> > as if it's setting the datepicker to Swedish ($.datepicker.setDefaults
> > ($.datepicker.regional['sv'])) but my datepickers are still in
> > English.
>
> > My datepicker code looks like this
> > $("#date_to").datepicker({
> >         dateFormat: 'yy-mm-dd',
> >         minDate: new Date(),
> >         onSelect: function(dateText, ui) {
> >                 console.log(dateText);
> >         }
>
> > });
>
> > What do I need to do to get this to work?
>
> > Kindly,
> > Marcus

--

You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to jquery...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-ui+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=.


Reply via email to