JQuery datepicker:怎么翻译? (不接受dayNamesShort)

时间:2009-09-17 06:40:16

标签: jquery jquery-ui

我试图翻译JQuery的datepicker但没有取得多大成功。使用下面的代码,几个月可以正确翻译,而天(短)不会被翻译!怎么了?

<script type="text/javascript">
  $(function() {
    ...
    $("#datepicker").datepicker({
      onChangeMonthYear: function(year, month, inst) {...},
      beforeShowDay: function(date) {...},
      onSelect: function(dateText, inst) {...},

      dayNamesShort: ['D', 'L', 'M', 'M', 'G', 'V', 'S'],
      dayNames: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
      monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
      monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'],
      firstDay: 1
    });
  }
  );
</script>

2 个答案:

答案 0 :(得分:8)

来自源代码:

dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday

您还需要翻译dayNamesMin。

答案 1 :(得分:0)

$("#datepicker").datepicker({
            dayNames: ["one", "two", "three", "four", "five", "six", "seven"],
            dayNamesShort: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"],
            dayNamesMin: ["Sunday", "Monday", "Tuesday", "Wednesday", 
                          "Sandeep", "Friday", "Saturday"],
            dateFormat: "y-MM-D", //To show dayNamesShort Values
            dateFormat: "y-MM-DD", //To show dayNames Values});

注意:dayNamesdayNamesShort一次选择任意一个。