diff --git a/docs/i18n/detail/options.md b/docs/i18n/detail/options.md index d5731a1f..6ab90648 100644 --- a/docs/i18n/detail/options.md +++ b/docs/i18n/detail/options.md @@ -41,7 +41,7 @@ i18n.set({ verifyErrorPromptTitle: '提示' }, laydate: { - month: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'], + months: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'], weeks: ['日', '一', '二', '三', '四', '五', '六'], time: ['时', '分', '秒'], selectDate: '选择日期', @@ -54,9 +54,10 @@ i18n.set({ now: '现在', reset: '重置' }, - timeout: '结束时间不能早于开始时间\n请重新选择', - invalidDate: '不在有效日期或时间范围内', - formatError: ['日期格式不合法\n必须遵循下述格式:\n', '\n已为你重置'], + rangeOrderPrompt: '结束时间不能早于开始时间\n请重新选择', + invalidDatePrompt: '不在有效日期或时间范围内\n', + formatErrorPrompt: '日期格式不合法\n必须遵循:\n{format}\n', + autoResetPrompt: '已自动重置', preview: '当前选中的结果' }, layer: { diff --git a/examples/i18n/en.js b/examples/i18n/en.js index fabfe301..ae6b1f7d 100644 --- a/examples/i18n/en.js +++ b/examples/i18n/en.js @@ -41,7 +41,7 @@ export default { verifyErrorPromptTitle: 'Notice' }, laydate: { - month: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], time: ['Hour', 'Minute', 'Second'], selectDate: 'Select Date', @@ -54,9 +54,10 @@ export default { now: 'Now', reset: 'Reset' }, - timeout: 'End time cannot be less than start Time\nPlease re-select', - invalidDate: 'Invalid date', - formatError: ['The date format error\nMust be followed:\n', '\nIt has been reset'], + rangeOrderPrompt: 'End time cannot be less than start Time\nPlease re-select', + invalidDatePrompt: 'Invalid date\n', + formatErrorPrompt: 'Date format is invalid\nMust follow the format:\n{format}\n', + autoResetPrompt: 'It has been reset', preview: 'The selected result' }, layer: { diff --git a/examples/i18n/fr.js b/examples/i18n/fr.js index 7516e230..536a022b 100644 --- a/examples/i18n/fr.js +++ b/examples/i18n/fr.js @@ -40,7 +40,7 @@ export default { verifyErrorPromptTitle: 'Avertissement' }, laydate: { - month: ['Janv', 'Févr', 'Mars', 'Avr', 'Mai', 'Juin', 'Juil', 'Août', 'Sept', 'Oct', 'Nov', 'Déc'], + months: ['Janv', 'Févr', 'Mars', 'Avr', 'Mai', 'Juin', 'Juil', 'Août', 'Sept', 'Oct', 'Nov', 'Déc'], weeks: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'], time: ['Heure', 'Minute', 'Seconde'], selectDate: 'Sélec. date', @@ -54,9 +54,10 @@ export default { now: 'Ajd.', reset: 'Réinit.' }, - timeout: 'L’heure de fin ne peut pas être antérieure à l’heure de début\nVeuillez recommencer', - invalidDate: 'Date ou heure hors plage valide', - formatError: ['Format de date invalide\nLe format attendu est :\n', '\nIl a été réinitialisé pour vous'], + rangeOrderPrompt: 'L’heure de fin ne peut pas être antérieure à l’heure de début\nVeuillez recommencer', + invalidDatePrompt: 'Date ou heure hors plage valide\n', + formatErrorPrompt: 'Format de date invalide\nLe format attendu est :\n{format}\n', + autoResetPrompt: 'Il a été réinitialisé pour vous', preview: 'Résultat sélectionné actuel' }, layer: { diff --git a/examples/i18n/zh-HK.js b/examples/i18n/zh-HK.js index 3ddc362f..9d500b5c 100644 --- a/examples/i18n/zh-HK.js +++ b/examples/i18n/zh-HK.js @@ -40,7 +40,7 @@ export default { verifyErrorPromptTitle: '提示' }, laydate: { - month: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], + months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], weeks: ['日', '一', '二', '三', '四', '五', '六'], time: ['時', '分', '秒'], selectDate: '選擇日期', @@ -53,9 +53,10 @@ export default { now: '現在', reset: '重設' }, - timeout: '結束時間不能早於開始時間\n請重新選擇', - invalidDate: '不在有效日期或時間範圍內', - formatError: ['日期格式不合法\n必須遵循以下格式:\n', '\n已為你重設'], + rangeOrderPrompt: '結束時間不能早於開始時間\n請重新選擇', + invalidDatePrompt: '不在有效日期或時間範圍內\n', + formatErrorPrompt: '日期格式不合法\n必須遵循:\n{format}\n', + autoResetPrompt: '已自動重設', preview: '當前選中的結果' }, layer: { diff --git a/src/modules/i18n.js b/src/modules/i18n.js index 32588caf..1714152a 100644 --- a/src/modules/i18n.js +++ b/src/modules/i18n.js @@ -53,7 +53,7 @@ layui.define('lay', function(exports) { verifyErrorPromptTitle: '提示' }, laydate: { - month: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'], + months: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'], weeks: ['日', '一', '二', '三', '四', '五', '六'], time: ['时', '分', '秒'], selectDate: '选择日期', @@ -66,9 +66,10 @@ layui.define('lay', function(exports) { now: '现在', reset: '重置' }, - timeout: '结束时间不能早于开始时间\n请重新选择', - invalidDate: '不在有效日期或时间范围内', - formatError: ['日期格式不合法\n必须遵循下述格式:\n', '\n已为你重置'], + rangeOrderPrompt: '结束时间不能早于开始时间\n请重新选择', + invalidDatePrompt: '不在有效日期或时间范围内\n', + formatErrorPrompt: '日期格式不合法\n必须遵循:\n{format}\n', + autoResetPrompt: '已自动重置', preview: '当前选中的结果' }, layer: { @@ -112,7 +113,7 @@ layui.define('lay', function(exports) { asc: '升序', desc: '降序' }, - noData: '无数据', + noData: '暂无数据', tools:{ filter: { title: '筛选列' @@ -132,14 +133,14 @@ layui.define('lay', function(exports) { xhrError: '请求异常,错误提示:{msg}' }, transfer: { - noData: '无数据', + noData: '暂无数据', noMatch: '无匹配数据', title: ['列表一', '列表二'], searchPlaceholder: '关键词搜索' }, tree: { defaultNodeName: '未命名', - noData: '无数据', + noData: '暂无数据', deleteNodePrompt: '确认删除"{name}"节点吗?' }, upload: { @@ -152,7 +153,7 @@ layui.define('lay', function(exports) { validateMessages: { fileExtensionError: '选择的{fileType}中包含不支持的格式', filesOverLengthLimit: '同时最多只能上传: {length} 个文件', - currentFilesLength: '您当前已经选择了: {length} 个文件', + currentFilesLength: '当前已经选择了: {length} 个文件', fileOverSizeLimit: '文件大小不能超过 {size}' }, chooseText: '{length} 个文件' diff --git a/src/modules/laydate.js b/src/modules/laydate.js index ead40fc0..64d20ebb 100644 --- a/src/modules/laydate.js +++ b/src/modules/laydate.js @@ -194,7 +194,7 @@ layui.define(['lay', 'i18n'], function(exports) { locale = options.lang; return { - month: i18n.$t('laydate.month', null, { + months: i18n.$t('laydate.months', null, { locale: locale, default: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }), @@ -240,19 +240,25 @@ layui.define(['lay', 'i18n'], function(exports) { default: 'Reset' }) }, - timeout: i18n.$t('laydate.timeout', null, { + rangeOrderPrompt: i18n.$t('laydate.rangeOrderPrompt', null, { locale: locale, default: 'End time cannot be less than start Time\nPlease re-select' }), - invalidDate: i18n.$t('laydate.invalidDate', null, { + invalidDatePrompt: i18n.$t('laydate.invalidDatePrompt', null, { locale: locale, - default: 'Invalid date' + default: 'Invalid date\n' }), - formatError: i18n.$t('laydate.formatError', null, { + formatErrorPrompt: function (format) { + return i18n.$t('laydate.formatErrorPrompt', {format: format}, { + locale: locale, + default: 'Date format is invalid\nMust follow the format:\n{format}\n' + }); + }, + autoResetPrompt: i18n.$t('laydate.autoResetPrompt', null, { locale: locale, - default: ['The date format error\nMust be followed:\n', '\nIt has been reset'] + default: 'It has been reset' }), - preview: i18n.$t('laydate.preview', null, { + previewPrompt: i18n.$t('laydate.previewPrompt', null, { locale: locale, default: 'The selected result' }) @@ -998,9 +1004,12 @@ layui.define(['lay', 'i18n'], function(exports) { } } else { //格式不合法 - that.hint(lang.formatError[0] + ( - options.range ? (options.format + ' '+ that.rangeStr +' ' + options.format) : options.format - ) + lang.formatError[1]); + that.hint( + lang.formatErrorPrompt( + options.range ? (options.format + ' '+ that.rangeStr +' ' + options.format) : options.format + ) + + lang.autoResetPrompt + ); error = true; } } else if(value && layui.type(value) === 'date'){ //若值为日期对象 @@ -1078,7 +1087,7 @@ layui.define(['lay', 'i18n'], function(exports) { // 初始值不在最大最小范围内 if(minMaxError && value){ that.setValue(that.parse()); - that.hint('value ' + lang.invalidDate + lang.formatError[1]); + that.hint('value ' + lang.invalidDatePrompt + lang.autoResetPrompt); } // 初始赋值 startDate,endState @@ -1473,8 +1482,8 @@ layui.define(['lay', 'i18n'], function(exports) { ,tds = lay(that.table[index]).find('td') ,elemYM = lay(that.elemHeader[index][2]).find('span'); - if(dateTime.year < LIMIT_YEAR[0]) dateTime.year = LIMIT_YEAR[0], that.hint(lang.invalidDate); - if(dateTime.year > LIMIT_YEAR[1]) dateTime.year = LIMIT_YEAR[1], that.hint(lang.invalidDate); + if(dateTime.year < LIMIT_YEAR[0]) dateTime.year = LIMIT_YEAR[0], that.hint(lang.invalidDatePrompt); + if(dateTime.year > LIMIT_YEAR[1]) dateTime.year = LIMIT_YEAR[1], that.hint(lang.invalidDatePrompt); //记录初始值 if(!that.firstDate){ @@ -1534,7 +1543,7 @@ layui.define(['lay', 'i18n'], function(exports) { lay(elemYM[0]).attr('lay-type', 'year').html(dateTime.year + ' 年') lay(elemYM[1]).attr('lay-type', 'month').html((dateTime.month + 1) + ' 月'); } else { - lay(elemYM[0]).attr('lay-type', 'month').html(lang.month[dateTime.month]); + lay(elemYM[0]).attr('lay-type', 'month').html(lang.months[dateTime.month]); lay(elemYM[1]).attr('lay-type', 'year').html(dateTime.year); } @@ -1693,7 +1702,7 @@ layui.define(['lay', 'i18n'], function(exports) { }; i + 1 == listYM[1] && lay(li).addClass(THIS); - li.innerHTML = lang.month[i] + (isCN ? '月' : ''); + li.innerHTML = lang.months[i] + (isCN ? '月' : ''); ul.appendChild(li); /* @@ -1962,7 +1971,7 @@ layui.define(['lay', 'i18n'], function(exports) { // 是否异常提示 if (tips && isOut) { - that.hint(lang.timeout); + that.hint(lang.rangeOrderPrompt); } } }; @@ -2383,7 +2392,7 @@ layui.define(['lay', 'i18n'], function(exports) { // 当前系统时间未在 min/max 范围内,则不可点击 if(lay(btn).hasClass(DISABLED)){ - return that.hint(lang.tools.now +', '+ lang.invalidDate); + return that.hint(lang.tools.now +', '+ lang.invalidDatePrompt); } lay.extend(dateTime, that.systemDate(), { @@ -2405,10 +2414,10 @@ layui.define(['lay', 'i18n'], function(exports) { ? that.startTime && that.endTime && that.newDate(that.startTime) > that.newDate(that.endTime) : that.startDate && that.endDate && that.newDate(lay.extend({},that.startDate, that.startTime || {})) > that.newDate(lay.extend({},that.endDate, that.endTime || {})); - return that.hint(isTimeout ? lang.timeout : lang.invalidDate); + return that.hint(isTimeout ? lang.rangeOrderPrompt : lang.invalidDatePrompt); } } else { - if(lay(btn).hasClass(DISABLED)) return that.hint(lang.invalidDate); + if(lay(btn).hasClass(DISABLED)) return that.hint(lang.invalidDatePrompt); } that.setValue(that.parse());