You'll need to load the i18n/ui.datepicker-sv.js file (for just
Swedish) or 18n/jquery-ui-i18n.js (for all locales) shortly after
loading jquery-ui.js,

Including these javascript resources does not "run" anything per-se.
Document-ready is one place to invoke all this, but you could also do
it on window.load(), like this:

$(window).load(function() {
// Your datepicker initialization here
}

It's generally a good idea to use $(window).load(....); for things
that don't require immediate invocation.

**--**  Steve



On Nov 20, 6:16 am, smurkas <[email protected]> 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 <[email protected]> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=.


Reply via email to