i18n optimizations

This commit is contained in:
RainLoop Team 2015-03-21 00:23:41 +04:00
parent 1d9acea5ae
commit 30b7ce263f
50 changed files with 353 additions and 353 deletions

View file

@ -66,29 +66,27 @@
$oEl = $(oElement)
;
sKey = $oEl.data('i18n-text');
sKey = $oEl.data('i18n');
if (sKey)
{
$oEl.text(this.i18n(sKey));
}
else
{
sKey = $oEl.data('i18n-html');
if (sKey)
if ('[' === sKey.substr(0, 1))
{
$oEl.html(this.i18n(sKey));
switch (sKey.substr(0, 6))
{
case '[html]':
$oEl.html(this.i18n(sKey.substr(6)));
break;
case '[place':
$oEl.attr('placeholder', this.i18n(sKey.substr(13)));
break;
case '[title':
$oEl.attr('title', this.i18n(sKey.substr(7)));
break;
}
}
sKey = $oEl.data('i18n-placeholder');
if (sKey)
else
{
$oEl.attr('placeholder', this.i18n(sKey));
}
sKey = $oEl.data('i18n-title');
if (sKey)
{
$oEl.attr('title', this.i18n(sKey));
$oEl.text(this.i18n(sKey));
}
}
};
@ -102,13 +100,13 @@
var self = this;
_.defer(function () {
$('.i18n', oElements).each(function () {
$('[data-i18n]', oElements).each(function () {
self.i18nToNode(this);
});
if (bAnimate && Globals.bAnimationSupported)
{
$('.i18n-animation.i18n', oElements).letterfx({
$('.i18n-animation[data-i18n]', oElements).letterfx({
'fx': 'fall fade', 'backwards': false, 'timing': 50, 'fx_duration': '50ms', 'letter_end': 'restore', 'element_end': 'restore'
});
}

View file

@ -405,7 +405,7 @@
kn.extendAsViewModel(['View/Popup/Contacts', 'PopupsContactsViewModel'], ContactsPopupView);
_.extend(ContactsPopupView.prototype, AbstractView.prototype);
ContactsPopupView.prototype.getPropertyPlceholder = function (sType)
ContactsPopupView.prototype.getPropertyPlaceholder = function (sType)
{
var sResult = '';
switch (sType)
@ -426,7 +426,7 @@
ContactsPopupView.prototype.addNewProperty = function (sType, sTypeStr)
{
this.viewProperties.push(new ContactPropertyModel(sType, sTypeStr || '', '', true, this.getPropertyPlceholder(sType)));
this.viewProperties.push(new ContactPropertyModel(sType, sTypeStr || '', '', true, this.getPropertyPlaceholder(sType)));
};
ContactsPopupView.prototype.addNewOrFocusProperty = function (sType, sTypeStr)
@ -649,10 +649,10 @@
}
aList.unshift(new ContactPropertyModel(Enums.ContactPropertyType.LastName, '', sLastName, false,
this.getPropertyPlceholder(Enums.ContactPropertyType.LastName)));
this.getPropertyPlaceholder(Enums.ContactPropertyType.LastName)));
aList.unshift(new ContactPropertyModel(Enums.ContactPropertyType.FirstName, '', sFirstName, !oContact,
this.getPropertyPlceholder(Enums.ContactPropertyType.FirstName)));
this.getPropertyPlaceholder(Enums.ContactPropertyType.FirstName)));
this.viewID(sId);