jQuery Datepicker UI language translation implementation

There are already localized versions of the jQuery Datepicker. The datepicker includes built-in support for languages that read right-to-left, such as Arabic and Hebrew.


For a multiple language website, the easiest way to do it is by loading the related language file which contain the range of rationalization options. After that set the datapicker default:

Example the settings:

	$.datepicker.regional['zh-CN'] = {
		closeText: '关闭',
		prevText: '<上月',
		nextText: '下月>',
		currentText: '今天',
		monthNames: ['一月','二月','三月','四月','五月','六月',
		monthNamesShort: ['一','二','三','四','五','六',
		dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
		dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
		dayNamesMin: ['日','一','二','三','四','五','六'],
		weekHeader: '周',
		dateFormat: 'yy-mm-dd',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: true,
		yearSuffix: '年'};

Two method to do this datapicker UI translation.
1. By loading language locale for jqueryui from google
2. By save and load the language locale file from local server or S3 strage.

method 1, example load language France:
Load the fr language files as below.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/i18n/jquery.ui.datepicker-fr.min.js"></script>

After that, set the datapicker default:






By Keenlio, March 11, 2014

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

5 + six =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>