I'm wondering if this is possible and if yes, how would I go about doing it? I'm trying to make the widget use a Jalali(Persian) Calender.
jQuery UI Datepicker localization
In general, to add localization to jQuery UI Datepicker you need to include a specific localization file immediately after including the Datepicker's script. For example, to set a French localization, you'd do this:
[...include jQuery and jQuery UI...]
<script type="text/javascript" src="jquery.ui.datepicker-fr.js"></script>
The localization files are included as part of the the standard jQuery UI download, in a separate directory (development-bundle/ui/i18n
). For more on this, see the Datepicker API documentation (under "Localization").
Current status: Farsi in, Jalali out
Currently, jQuery UI download package doesn't seem to include a Jalali localization file. For now, there seems to be only a regular (Georgian) calendar translated into Farsi (jquery.ui.datepicker-fr.js
).
Solution 1 - custom localization file
If you prefer to stick with jQuery UI's datepicker, you can create a custom localization file, based on the format of existing localization files. If you're familiar with the calendar in question, it shouldn't be difficult.
Solution 2 - use a different plugin
Consider using the jQuery Calendars plugin instead. It already includes most common world calendars in several languages and formats, so generating a Jalali or any other foreign calendar for that matter is done by the flick of a setting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With