国际化部分核心功能。

This commit is contained in:
thinkgem
2018-04-15 22:16:08 +08:00
parent ff19a2ea55
commit e8bfce2bce
5 changed files with 141 additions and 18 deletions

View File

@@ -10,6 +10,34 @@
;!function(window, undefined){
"use strict";
var messages;
var lang = window.lang || "zh_CN";
if (lang == 'en'){
messages = {
btnOk: 'Ok',
btnCancel: 'Cancle',
title: 'Information',
promptTipA: 'Enter ',
promptTipB: 'character at most.',
noPicture: 'No picture',
photoError: 'Current image address error.<br>Next slide?',
photoNextPage: 'The next',
photoClose: 'Close'
};
}else{
messages = {
btnOk: '确定',
btnCancel: '取消',
title: '信息',
promptTipA: '最多输入',
promptTipB: '个字符',
noPicture: '没有图片',
photoError: '当前图片地址异常<br>是否继续查看下一张?',
photoNextPage: '下一张',
photoClose: '不看了'
};
}
var isLayui = window.layui && layui.define, $, win, ready = {
getPath: function(){
var js = document.scripts, script = js[js.length - 1], jsPath = script.src;
@@ -18,7 +46,7 @@ var isLayui = window.layui && layui.define, $, win, ready = {
}(),
config: {}, end: {}, minIndex: 0, minLeft: [],
btn: ['&#x786E;&#x5B9A;', '&#x53D6;&#x6D88;'],
btn: [messages.btnOk, messages.btnCancel],
//五种原始层模式
type: ['dialog', 'page', 'iframe', 'loading', 'tips']
@@ -184,7 +212,7 @@ Class.pt.config = {
shade: 0.3,
fixed: true,
move: doms[1],
title: '&#x4FE1;&#x606F;',
title: messages.title,
offset: 'auto',
area: 'auto',
closeBtn: 1,
@@ -994,7 +1022,7 @@ layer.prompt = function(options, yes){
return layer.open($.extend({
type: 1
,btn: ['&#x786E;&#x5B9A;','&#x53D6;&#x6D88;']
,btn: [messages.btnOk,messages.btnCancel]
,content: content
,skin: 'layui-layer-prompt' + skin('prompt')
,maxWidth: win.width()
@@ -1009,7 +1037,7 @@ layer.prompt = function(options, yes){
if(value === ''){
prompt.focus();
} else if(value.length > (options.maxlength||500)) {
layer.tips('&#x6700;&#x591A;&#x8F93;&#x5165;'+ (options.maxlength || 500) +'&#x4E2A;&#x5B57;&#x6570;', prompt, {tips: 1});
layer.tips(messages.promptTipA + (options.maxlength || 500) + messages.promptTipB, prompt, {tips: 1});
} else {
yes && yes(value, index, prompt);
}
@@ -1116,7 +1144,7 @@ layer.photos = function(options, loop, key){
if(!loop) return;
} else if (data.length === 0){
return layer.msg('&#x6CA1;&#x6709;&#x56FE;&#x7247;');
return layer.msg(message.noPicture);
}
//上一张
@@ -1261,9 +1289,9 @@ layer.photos = function(options, loop, key){
}, options));
}, function(){
layer.close(dict.loadi);
layer.msg('&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;', {
layer.msg(messages.photoError, {
time: 30000,
btn: ['&#x4E0B;&#x4E00;&#x5F20;', '&#x4E0D;&#x770B;&#x4E86;'],
btn: [messages.photoNextPage, messages.photoClose],
yes: function(){
data.length > 1 && dict.imgnext(true,true);
}