JQuery Datepicker Localization German

后端 未结 6 2353
醉酒成梦
醉酒成梦 2020-12-18 22:50

First off, I want to state, that I\'ve read a lot of threads on this Topic but none solved my Problem.

So I need a german JQuery Datepicker. So I set th

相关标签:
6条回答
  • 2020-12-18 22:52

    It is neccessary to combine the already given answeres here like this:

    Add to the Header:

    <script type="text/javascript" src="http://jquery-ui.googlecode.com/svn/tags/latest/ui/minified/i18n/jquery-ui-i18n.min.js"></script>
    

    and to your Code:

    $.datepicker.setDefaults($.datepicker.regional["de"]);
    

    That's it!

    0 讨论(0)
  • 2020-12-18 22:57

    The original code

    $("#datepicker").datepicker({
        numberOfMonths : 3,
        showButtonPanel : true,
        altField : "#datepicker_input",
        dateFormat : "dd-mm-yy"
    }, $.datepicker.regional['de']);
    

    should be fixed to the following

    $("#datepicker").datepicker($.extend({}, $.datepicker.regional["de"], {
        numberOfMonths : 3,
        showButtonPanel : true,
        altField : "#datepicker_input",
        dateFormat : "dd-mm-yy"
    }));
    
    0 讨论(0)
  • 2020-12-18 23:06

    To hide Chinese chars from muthu's answer, add inside the options:

      weekHeader: "W",
      yearSuffix: ""
    
    0 讨论(0)
  • 2020-12-18 23:08

    Eclose the "$.datepicker.setDefaults" call within:

    jQuery(function ($) { initialization; });
    

    Final result:

    jQuery(function ($) {
        $.datepicker.setDefaults($.datepicker.regional["de"]);
    });
    
    0 讨论(0)
  • 2020-12-18 23:11

    Check whether you have included the localization js file for the german

    if you not means include this

    <script type="text/javascript"
            src="http://jquery-ui.googlecode.com/svn/tags/latest/ui/minified/i18n/jquery-ui-i18n.min.js">
    </script>
    

    and code should be

     $(function() {
      $('#datepicker').datepicker({
           prevText: '&#x3c;zurück', prevStatus: '',
            prevJumpText: '&#x3c;&#x3c;', prevJumpStatus: '',
            nextText: 'Vor&#x3e;', nextStatus: '',
            nextJumpText: '&#x3e;&#x3e;', nextJumpStatus: '',
            currentText: 'heute', currentStatus: '',
            todayText: 'heute', todayStatus: '',
            clearText: '-', clearStatus: '',
            closeText: 'schließen', closeStatus: '',
            monthNames: ['Januar','Februar','März','April','Mai','Juni',
            'Juli','August','September','Oktober','November','Dezember'],
            monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
            'Jul','Aug','Sep','Okt','Nov','Dez'],
            dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
            dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
            dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
          showMonthAfterYear: false,
          showOn: 'both',
          buttonImage: 'media/img/calendar.png',
          buttonImageOnly: true,
          dateFormat:'d MM, y'
        } 
      );
    
    });
    

    Demo

    0 讨论(0)
  • 2020-12-18 23:19

    Ok, a little bit late, but perhaps someone needs it, try this:

    $.datepicker.setDefaults($.datepicker.regional["de"]);
    
    0 讨论(0)
提交回复
热议问题