Followup for issue #595 - fixed support of “xx-xx” locales.

This commit is contained in:
Martin Edenhofer 2017-01-09 14:02:10 +01:00
parent 3706bf0c6c
commit 8ac21a8d9e
3 changed files with 112 additions and 71 deletions

View file

@ -179,7 +179,7 @@ do($ = window.jQuery, window) ->
state: 'offline'
initialQueueDelay: 10000
translations:
de:
'de':
'<strong>Chat</strong> with us!': '<strong>Chatte</strong> mit uns!'
'Scroll down to see new messages': 'Scrolle nach unten um neue Nachrichten zu sehen'
'Online': 'Online'
@ -196,7 +196,7 @@ do($ = window.jQuery, window) ->
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Da Sie in den letzten %s Minuten nichts geschrieben haben wurde Ihre Konversation mit <strong>%s</strong> geschlossen.'
'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Da Sie in den letzten %s Minuten nichts geschrieben haben wurde Ihre Konversation geschlossen.'
'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Es tut uns leid, es dauert länger als erwartet, um einen freien Platz zu erhalten. Bitte versuchen Sie es zu einem späteren Zeitpunkt noch einmal oder schicken Sie uns eine E-Mail. Vielen Dank!'
fr:
'fr':
'<strong>Chat</strong> with us!': '<strong>Chattez</strong> avec nous!'
'Scroll down to see new messages': 'Faites défiler pour lire les nouveaux messages'
'Online': 'En-ligne'
@ -213,7 +213,7 @@ do($ = window.jQuery, window) ->
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Si vous ne répondez pas dans les <strong>%s</strong> minutes, votre conversation avec %s va être fermée.'
'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Si vous ne répondez pas dans les %s minutes, votre conversation va être fermée.'
'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Nous sommes désolés, il faut plus de temps que prévu pour obtenir un emplacement vide. Veuillez réessayer ultérieurement ou nous envoyer un courriel. Je vous remercie!'
zh-cn:
'zh-cn':
'<strong>Chat</strong> with us!': '发起<strong>即时对话</strong>!'
'Scroll down to see new messages': '向下滚动以查看新消息'
'Online': '在线'
@ -230,7 +230,7 @@ do($ = window.jQuery, window) ->
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': '由于您超过 %s 分钟没有回复, 您与 <strong>%s</strong> 的会话已被关闭.'
'Since you didn\'t respond in the last %s minutes your conversation got closed.': '由于您超过 %s 分钟没有任何回复, 该对话已被关闭.'
'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': '非常抱歉, 目前需要等候更长的时间才能接入对话, 请稍后重试或向我们发送电子邮件. 谢谢!'
zh-tw:
'zh-tw':
'<strong>Chat</strong> with us!': '開始<strong>即時對话</strong>!'
'Scroll down to see new messages': '向下滑動以查看新訊息'
'Online': '線上'
@ -302,7 +302,9 @@ do($ = window.jQuery, window) ->
if !@options.lang
@options.lang = $('html').attr('lang')
if @options.lang
@options.lang = @options.lang.replace(/-.+?$/, '') # replace "-xx" of xx-xx
if !@translations[@options.lang]
@log.debug "lang: No #{@options.lang} found, try first two letters"
@options.lang = @options.lang.replace(/-.+?$/, '') # replace "-xx" of xx-xx
@log.debug "lang: #{@options.lang}"
# detect host

View file

@ -305,7 +305,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
ZammadChat.prototype.initialQueueDelay = 10000;
ZammadChat.prototype.translations = {
de: {
'de': {
'<strong>Chat</strong> with us!': '<strong>Chatte</strong> mit uns!',
'Scroll down to see new messages': 'Scrolle nach unten um neue Nachrichten zu sehen',
'Online': 'Online',
@ -323,7 +323,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Da Sie in den letzten %s Minuten nichts geschrieben haben wurde Ihre Konversation geschlossen.',
'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Es tut uns leid, es dauert länger als erwartet, um einen freien Platz zu erhalten. Bitte versuchen Sie es zu einem späteren Zeitpunkt noch einmal oder schicken Sie uns eine E-Mail. Vielen Dank!'
},
fr: {
'fr': {
'<strong>Chat</strong> with us!': '<strong>Chattez</strong> avec nous!',
'Scroll down to see new messages': 'Faites défiler pour lire les nouveaux messages',
'Online': 'En-ligne',
@ -340,6 +340,42 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': 'Si vous ne répondez pas dans les <strong>%s</strong> minutes, votre conversation avec %s va être fermée.',
'Since you didn\'t respond in the last %s minutes your conversation got closed.': 'Si vous ne répondez pas dans les %s minutes, votre conversation va être fermée.',
'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': 'Nous sommes désolés, il faut plus de temps que prévu pour obtenir un emplacement vide. Veuillez réessayer ultérieurement ou nous envoyer un courriel. Je vous remercie!'
},
'zh-cn': {
'<strong>Chat</strong> with us!': '发起<strong>即时对话</strong>!',
'Scroll down to see new messages': '向下滚动以查看新消息',
'Online': '在线',
'Online': '在线',
'Offline': '离线',
'Connecting': '连接中',
'Connection re-established': '正在重新建立连接',
'Today': '今天',
'Send': '发送',
'Compose your message...': '正在输入信息...',
'All colleagues are busy.': '所有工作人员都在忙碌中.',
'You are on waiting list position <strong>%s</strong>.': '您目前的等候位置是第 <strong>%s</strong> 位.',
'Start new conversation': '开始新的会话',
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': '由于您超过 %s 分钟没有回复, 您与 <strong>%s</strong> 的会话已被关闭.',
'Since you didn\'t respond in the last %s minutes your conversation got closed.': '由于您超过 %s 分钟没有任何回复, 该对话已被关闭.',
'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': '非常抱歉, 目前需要等候更长的时间才能接入对话, 请稍后重试或向我们发送电子邮件. 谢谢!'
},
'zh-tw': {
'<strong>Chat</strong> with us!': '開始<strong>即時對话</strong>!',
'Scroll down to see new messages': '向下滑動以查看新訊息',
'Online': '線上',
'Online': '線上',
'Offline': '离线',
'Connecting': '連線中',
'Connection re-established': '正在重新建立連線中',
'Today': '今天',
'Send': '發送',
'Compose your message...': '正在輸入訊息...',
'All colleagues are busy.': '所有服務人員都在忙碌中.',
'You are on waiting list position <strong>%s</strong>.': '你目前的等候位置是第 <strong>%s</strong> 順位.',
'Start new conversation': '開始新的對話',
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.': '由於你超過 %s 分鐘沒有回應, 你與 <strong>%s</strong> 的對話已被關閉.',
'Since you didn\'t respond in the last %s minutes your conversation got closed.': '由於你超過 %s 分鐘沒有任何回應, 該對話已被關閉.',
'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!': '非常抱歉, 當前需要等候更長的時間方可排入對話程序, 請稍後重試或向我們寄送電子郵件. 謝謝!'
}
};
@ -446,7 +482,10 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
this.options.lang = $('html').attr('lang');
}
if (this.options.lang) {
this.options.lang = this.options.lang.replace(/-.+?$/, '');
if (!this.translations[this.options.lang]) {
this.log.debug("lang: No " + this.options.lang + " found, try first two letters");
this.options.lang = this.options.lang.replace(/-.+?$/, '');
}
this.log.debug("lang: " + this.options.lang);
}
if (!this.options.host) {
@ -1294,67 +1333,6 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
return window.ZammadChat = ZammadChat;
})(window.jQuery, window);
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["agent"] = function (__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
};
}
(function() {
(function() {
if (this.agent.avatar) {
__out.push('\n<img class="zammad-chat-agent-avatar" src="');
__out.push(__sanitize(this.agent.avatar));
__out.push('">\n');
}
__out.push('\n<span class="zammad-chat-agent-sentence">\n <span class="zammad-chat-agent-name">');
__out.push(__sanitize(this.agent.name));
__out.push('</span>\n</span>');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
};
/*!
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
@ -1447,6 +1425,67 @@ jQuery.fn.autoGrow = function(options) {
});
};
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["agent"] = function (__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
};
}
(function() {
(function() {
if (this.agent.avatar) {
__out.push('\n<img class="zammad-chat-agent-avatar" src="');
__out.push(__sanitize(this.agent.avatar));
__out.push('">\n');
}
__out.push('\n<span class="zammad-chat-agent-sentence">\n <span class="zammad-chat-agent-name">');
__out.push(__sanitize(this.agent.name));
__out.push('</span>\n</span>');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
};
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}

File diff suppressed because one or more lines are too long