NoWar
NoWar

Reputation: 37632

How to setup language for jQuery datapicker?

I just just use the standard package of http://jqueryui.com/demos/datepicker/.

And docs there doesn't say how to setup some other language than English.

So I have this code and how I can implement it?

<script type="text/javascript">
        $(function () {

            // Datepicker
            $('.datepicker').datepicker({
                inline: true
            });

        });

    </script>

This link says that I have to do like

<script type="text/javascript" src="js/jquery.ui.datepicker-<% insert language code here%>.js"></script>

But I have totally different links to files...

Links:

 <link href="@Url.Content("~/Scripts/jquery-ui-1.8.18/css/flick/jquery-ui-1.8.18.custom.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.18/js/jquery-1.7.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.18/js/jquery-ui-1.8.18.custom.min.js")" type="text/javascript"></script>

Upvotes: 0

Views: 2104

Answers (2)

Alex
Alex

Reputation: 35407

A quick google search resulted in the following post:

http://forum.jquery.com/topic/automatic-localization-of-datepicker

Looks like you need to download a localized version of jQuery UI depending on the current culture the user has his browser set to.


Include jquery.ui.datepicker.js first

Then, jquery.ui.datepicker-en-US.js (localized script depending on the current browsers' culture)

Upvotes: 3

Tats_innit
Tats_innit

Reputation: 34117

Hey are you looking for this

http://docs.jquery.com/UI/Datepicker/Localization

localized demo: http://jqueryui.com/demos/datepicker/#localization

Keith wood has a personal page as well if you google Jquery datepicker.

   Example from the link :

 <script>
        $(function() {
            $.datepicker.setDefaults( $.datepicker.regional[ "" ] );
            $( "#datepicker" ).datepicker( $.datepicker.regional[ "fr" ] );
            $( "#locale" ).change(function() {
                $( "#datepicker" ).datepicker( "option",
                    $.datepicker.regional[ $( this ).val() ] );
            });
    });
    </script>

Hope this helps, cheers

Upvotes: 2

Related Questions