为什么我的jquery UI datepicker不会默认为英文

前端之家收集整理的这篇文章主要介绍了为什么我的jquery UI datepicker不会默认为英文前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我基本上复制了代码 from here,但是当我测试我的网站我看到这样:

alt text http://img148.imageshack.us/img148/8167/datepicker.png

任何想法为什么我没有得到一个英文日历

解决方法

From the jQuery UI docs,它是基于您的计算机的区域设置,如c0mrade在评论中所说,但您可以覆盖:

本土化

Datepicker provides support for localizing its content to cater for different languages and date formats. Each localization is contained within its own file with the language code appended to the name,e.g. jquery.ui.datepicker-fr.js for French. These files are loaded after the main datepicker code. They add their settings to the set of available localizations and automatically apply them as defaults for all instances.

The $.datepicker.regional attribute holds an array of localizations,indexed by language code,with ” referring to the default (English). Each entry is an object with the following attributes: closeText,prevText,nextText,currentText,monthNames,monthNamesShort,dayNames,dayNamesShort,dayNamesMin,weekHeader,dateFormat,firstDay,isRTL,showMonthAfterYear,and yearSuffix.

You can restore the default localizations with:

$.datepicker.setDefaults($.datepicker.regional['']);

And can then override an individual datepicker for a specific locale:

$(selector).datepicker($.datepicker.regional['fr']);
原文链接:/jquery/180093.html

猜你在找的jQuery相关文章