如何在datepicker中更改语言?

时间:2018-01-10 06:20:07

标签: javascript php jquery datepicker

如何更改jquery datepicker语言,这里我附上了视图截图

我更改了datepicker.src.js中的月份拼写,但是我找不到工作日来自哪里

请帮我用英文显示

Click here for calendar screen image

这里我附上了整个文件的链接

https://drive.google.com/drive/folders/1qeWfhjVU_eD4FQG4IPg4bkEzXFG50iXX?usp=sharing

谢谢。

3 个答案:

答案 0 :(得分:1)

编辑文件“ bootstrap-datepicker.js”以添加您的语言:

const EmojiWrap = props => {
  return (
    <span role="img" aria-label="sheep">
      {props.children}
    </span>
  );
};

<EmojiWrap></EmojiWrap>

您可以使用任何语言,例如:

aria-hidden="true"

var dates = $.fn.datepicker.dates = {
            de: {
        days: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"],
        daysShort: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"],
        daysMin: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"],
        months: ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],
        monthsShort: ["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],
        today: "Heute",
        clear: "Schließen"
    },

    en: {
        days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
        daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
        daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
        months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
        monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
        today: "Today",
        clear: "Clear"
    }

};

答案 1 :(得分:1)

在此处更改

days: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"],
        daysShort: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"],
        daysMin: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"],

days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sonntag"],

        daysShort: ["Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat"],

        daysMin: ["Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat"],

答案 2 :(得分:0)

从这里下载语言明智的所有datepicker文件:[https://github.com/jquery/jquery-ui/tree/master/ui/i18n][1]我希望它能运作。

 <!doctype html>
        <html>
        <head>
         <meta charset="UTF-8" />
         <!-- Script -->
         <script src='jquery-3.2.1.min.js' type='text/javascript'></script>

         <!-- jQuery UI -->
         <link href='jquery-ui.min.css' rel='stylesheet' type='text/css'>
         <script src='jquery-ui.min.js' type='text/javascript'></script>

         <!-- Language script -->
            <script src="datepicker-fr.js" type='text/javascript'></script>
             <script src="datepicker-he.js" type='text/javascript'></script>
              <script src="datepicker-zh-TW.js" type='text/javascript'></script>
              <script src='datepicker-hi.js' type='text/javascript'></script>
        </head>
        <body>

         Select Date : <input type='text' id='datepicker' ><br/>

         <!-- Script -->
         <script type='text/javascript' >
         $( function() {

          // Initialize and change language to hindi
          $('#datepicker').datepicker( $.datepicker.regional[ "hi" ] );

         });
         </script>

        </body>
        </html>