热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

bootstrapdatepicker插件修改为中文显示

1、打开bootstrap-datepicker.js文件2、增加语言选项3、设置language属性,中文为默认显示4、修改好后,把bootstrap-datepicker.js

1、打开bootstrap-datepicker.js文件

2、增加语言选项

var dates = $.fn.datepicker.dates = {
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"
},
cn: {
days: [
"周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
daysShort: [
"", "", "", "", "", "", "", ""],
daysMin: [
"", "", "", "", "", "", "", ""],
months: [
"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
monthsShort: [
"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
today:
"今天",
clear:
"清除"
}
};

3、设置language属性,中文为默认显示

var defaults = $.fn.datepicker.defaults = {
autoclose:
false,
beforeShowDay: $.noop,
calendarWeeks:
false,
clearBtn:
false,
daysOfWeekDisabled: [],
endDate: Infinity,
forceParse:
true,
format:
yyyy-mm-dd,
keyboardNavigation:
true,
language:
cn,
minViewMode:
0,
multidate:
false,
multidateSeparator:
,,
orientation:
"auto",
rtl:
false,
startDate:
-Infinity,
startView:
0,
todayBtn:
false,
todayHighlight:
false,
weekStart:
0
};

4、修改好后,把bootstrap-datepicker.js文件保存为UTF-8格式

 


推荐阅读
author-avatar
手机用户2602883205_410
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有