Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download jQuery script to localize datepicker

I want to use jQuery datepicker localize in our MVC project, but I can't find languages js files as here explain we need some file like this: jquery.ui.datepicker-fr.js but the only link I can find is this and we are in Iran can't access to that, is there any link to download languages js files?, also I need Persian (Farsi) version, something like this: jquery.ui.datepicker-fa.js

like image 481
Saeid Avatar asked Mar 01 '12 09:03

Saeid


People also ask

How do I localize a date picker?

The first step to localize the Date Picker is to load the locale file on your website. You can download the locale from GitHub, upload it to your website, and enqueue the file. In the example below, we are loading a Russian locale directly from a CDN.

How to use datepicker using jQuery?

The datepicker is tied to a standard form input field. Focus on the input (click, or use the tab key) to open an interactive calendar in a small overlay. Choose a date, click elsewhere on the page (blur the input), or hit the Esc key to close. If a date is chosen, feedback is shown as the input's value.

How to use datepicker in JavaScript?

We can include datepicker feature in our javascript program by specifying the below inside the <head> and <body> tags. Inside <head> we have to use “datepicker. min. css” and inside <body> tag use “datepicker.


1 Answers

French:

/* French initialisation for the jQuery UI date picker plugin. */
/* Written by Keith Wood (kbwood{at}iinet.com.au) and Stéphane Nahmani ([email protected]). */
jQuery(function($){
    $.datepicker.regional['fr'] = {
        closeText: 'Fermer',
        prevText: '&#x3c;Préc',
        nextText: 'Suiv&#x3e;',
        currentText: 'Courant',
        monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
        'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
        monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun',
        'Jul','Aoû','Sep','Oct','Nov','Déc'],
        dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
        dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
        dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
        weekHeader: 'Sm',
        dateFormat: 'dd/mm/yy',
        firstDay: 1,
        isRTL: false,
        showMonthAfterYear: false,
        yearSuffix: ''};
    $.datepicker.setDefaults($.datepicker.regional['fr']);
});

Farsi:

/* Persian (Farsi) Translation for the jQuery UI date picker plugin. */
/* Javad Mowlanezhad -- [email protected] */
/* Jalali calendar should supported soon! (Its implemented but I have to test it) */
jQuery(function($) {
    $.datepicker.regional['fa'] = {
        closeText: 'بستن',
        prevText: '&#x3c;قبلي',
        nextText: 'بعدي&#x3e;',
        currentText: 'امروز',
        monthNames: ['فروردين','ارديبهشت','خرداد','تير','مرداد','شهريور',
        'مهر','آبان','آذر','دي','بهمن','اسفند'],
        monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'],
        dayNames: ['يکشنبه','دوشنبه','سه‌شنبه','چهارشنبه','پنجشنبه','جمعه','شنبه'],
        dayNamesShort: ['ي','د','س','چ','پ','ج', 'ش'],
        dayNamesMin: ['ي','د','س','چ','پ','ج', 'ش'],
        weekHeader: 'هف',
        dateFormat: 'yy/mm/dd',
        firstDay: 6,
        isRTL: true,
        showMonthAfterYear: false,
        yearSuffix: ''};
    $.datepicker.setDefaults($.datepicker.regional['fa']);
});

Simply add them seperately to files and name them as required and everything will work out fine ;-)

like image 157
mas-designs Avatar answered Sep 30 '22 17:09

mas-designs