Rename Localization.get method on the client side

This commit is contained in:
Dmitriy Simushev 2014-08-18 09:11:40 +00:00
parent 7128870ef6
commit 17d7014da9
8 changed files with 16 additions and 16 deletions

View File

@ -39,7 +39,7 @@
*/ */
closeThread: function() { closeThread: function() {
// Show confirmation message if can // Show confirmation message if can
var confirmMessage = Mibew.Localization.get('Are you sure want to leave chat?'); var confirmMessage = Mibew.Localization.trans('Are you sure want to leave chat?');
if (confirmMessage !== false) { if (confirmMessage !== false) {
if (! confirm(confirmMessage)) { if (! confirm(confirmMessage)) {
return; return;

View File

@ -53,24 +53,24 @@
// Check email // Check email
if (typeof attributes.email != 'undefined') { if (typeof attributes.email != 'undefined') {
if (! attributes.email) { if (! attributes.email) {
return l.get('leavemessage.error.email.required'); return l.trans('leavemessage.error.email.required');
} }
if(! Mibew.Utils.checkEmail(attributes.email)) { if(! Mibew.Utils.checkEmail(attributes.email)) {
return l.get('leavemessage.error.wrong.email'); return l.trans('leavemessage.error.wrong.email');
} }
} }
// Check name // Check name
if (typeof attributes.name != 'undefined') { if (typeof attributes.name != 'undefined') {
if (! attributes.name) { if (! attributes.name) {
return l.get('leavemessage.error.name.required'); return l.trans('leavemessage.error.name.required');
} }
} }
// Check message // Check message
if (typeof attributes.message != 'undefined') { if (typeof attributes.message != 'undefined') {
if (! attributes.message) { if (! attributes.message) {
return l.get('leavemessage.error.message.required'); return l.trans('leavemessage.error.message.required');
} }
} }
@ -78,7 +78,7 @@
if (this.get('showCaptcha')) { if (this.get('showCaptcha')) {
if (typeof attributes.captcha != 'undefined') { if (typeof attributes.captcha != 'undefined') {
if (! attributes.captcha) { if (! attributes.captcha) {
return l.get('The letters you typed don\'t match the letters that were shown in the picture.'); return l.trans('The letters you typed don\'t match the letters that were shown in the picture.');
} }
} }
} }

View File

@ -55,7 +55,7 @@
if (this.get('showEmail')) { if (this.get('showEmail')) {
if (typeof attributes.email != 'undefined') { if (typeof attributes.email != 'undefined') {
if(! Mibew.Utils.checkEmail(attributes.email)) { if(! Mibew.Utils.checkEmail(attributes.email)) {
return Mibew.Localization.get( return Mibew.Localization.trans(
'Wrong email address.' 'Wrong email address.'
); );
} }

View File

@ -108,7 +108,7 @@
* This helper returns translated string with specified key * This helper returns translated string with specified key
*/ */
Handlebars.registerHelper('l10n', function(key) { Handlebars.registerHelper('l10n', function(key) {
return (Mibew.Localization.get(key) || ''); return (Mibew.Localization.trans(key) || '');
}); });
/** /**

View File

@ -24,7 +24,7 @@
* @param {String} str String for localization * @param {String} str String for localization
* @returns {String} Localized string * @returns {String} Localized string
*/ */
Mibew.Localization.get = function(str) { Mibew.Localization.trans = function(str) {
if (! localStrings.hasOwnProperty(str)) { if (! localStrings.hasOwnProperty(str)) {
return false; return false;
} }

View File

@ -23,7 +23,7 @@
badRequestsCount++; badRequestsCount++;
// Check if there is // Check if there is
if (badRequestsCount == 10) { if (badRequestsCount == 10) {
alert(Mibew.Localization.get('Network problems detected. Please refresh the page.')); alert(Mibew.Localization.trans('Network problems detected. Please refresh the page.'));
badRequestsCount = 0; badRequestsCount = 0;
} }
} }

View File

@ -166,7 +166,7 @@
if (Mibew.Objects.Models.page.get('showPopup')) { if (Mibew.Objects.Models.page.get('showPopup')) {
this.once('render', function() { this.once('render', function() {
alert( alert(
Mibew.Localization.get('A new visitor is waiting for an answer.') Mibew.Localization.trans('A new visitor is waiting for an answer.')
); );
}) })
} }

View File

@ -109,19 +109,19 @@
stateToDesc: function(state) { stateToDesc: function(state) {
var l = Mibew.Localization; var l = Mibew.Localization;
if (state == this.model.STATE_QUEUE) { if (state == this.model.STATE_QUEUE) {
return l.get('In queue'); return l.trans('In queue');
} }
if (state == this.model.STATE_WAITING) { if (state == this.model.STATE_WAITING) {
return l.get('Waiting for operator'); return l.trans('Waiting for operator');
} }
if (state == this.model.STATE_CHATTING) { if (state == this.model.STATE_CHATTING) {
return l.get('In chat'); return l.trans('In chat');
} }
if (state == this.model.STATE_CLOSED) { if (state == this.model.STATE_CLOSED) {
return l.get('Closed'); return l.trans('Closed');
} }
if (state == this.model.STATE_LOADING) { if (state == this.model.STATE_LOADING) {
return l.get('Loading'); return l.trans('Loading');
} }
return ""; return "";
}, },