问题
hello im new to jquery and since my application is in french I want to change the language of datepicker to match it since not everyone who will use the app knows english
Here is my datepicker with jquery-ui as a simplified version:
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$(document).ready(function () {
$.datepicker.setDefaults($.datepicker.regional['fr']);
$("#datepicker").datepicker({
format: 'DD-MM-YYYY'
});
});
</script>
<input type="text" id="datepicker" />
Here is the link to the jsfiddle : https://jsfiddle.net/r1cpw2sn/ datepicker.setdefaults dosen't seem to work and I didn't find another option appart from putting all month name in an array which dosen't seem like a good idea to me
Any tips on how to make this work would be really appreciated
回答1:
You need to add specific language file to your project as specified in this.
and also refer stack overflows answer in this link.
来源:https://stackoverflow.com/questions/43981638/changing-language-of-jquery-ui-datepicker