mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Admin Panel localization (#467)
This commit is contained in:
parent
470b3645e2
commit
3dac6809d1
46 changed files with 1111 additions and 561 deletions
|
|
@ -67,7 +67,7 @@
|
|||
{
|
||||
if (oData.Result)
|
||||
{
|
||||
require('App/Admin').loginAndLogoutReload();
|
||||
require('App/Admin').loginAndLogoutReload(true);
|
||||
}
|
||||
else if (oData.ErrorCode)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
PaneSettingsAdminView.prototype.logoutClick = function ()
|
||||
{
|
||||
Remote.adminLogout(function () {
|
||||
require('App/Admin').loginAndLogoutReload(true);
|
||||
require('App/Admin').loginAndLogoutReload(true, true);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,10 @@
|
|||
this.activateText = ko.observable('');
|
||||
this.activateText.isError = ko.observable(false);
|
||||
|
||||
this.htmlDescription = ko.computed(function () {
|
||||
return Translator.i18n('POPUPS_ACTIVATE/HTML_DESC', {'DOMAIN': this.domain()});
|
||||
}, this);
|
||||
|
||||
this.key.subscribe(function () {
|
||||
this.activateText('');
|
||||
this.activateText.isError(false);
|
||||
|
|
@ -67,7 +71,7 @@
|
|||
if (true === oData.Result)
|
||||
{
|
||||
self.activationSuccessed(true);
|
||||
self.activateText('Subscription Key Activated Successfully');
|
||||
self.activateText(Translator.i18n('POPUPS_ACTIVATE/SUBS_KEY_ACTIVATED'));
|
||||
self.activateText.isError(false);
|
||||
}
|
||||
else
|
||||
|
|
@ -95,7 +99,7 @@
|
|||
else
|
||||
{
|
||||
this.activateProcess(false);
|
||||
this.activateText('Invalid Subscription Key');
|
||||
this.activateText(Translator.i18n('POPUPS_ACTIVATE/ERROR_INVALID_SUBS_KEY'));
|
||||
this.activateText.isError(true);
|
||||
this.key.focus(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
Globals = require('Common/Globals'),
|
||||
Utils = require('Common/Utils'),
|
||||
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
CapaAdminStore = require('Stores/Admin/Capa'),
|
||||
|
||||
Remote = require('Remote/Admin/Ajax'),
|
||||
|
|
@ -96,8 +98,9 @@
|
|||
|
||||
this.headerText = ko.computed(function () {
|
||||
var sName = this.name();
|
||||
return this.edit() ? 'Edit Domain "' + sName + '"' :
|
||||
'Add Domain' + ('' === sName ? '' : ' "' + sName + '"');
|
||||
return this.edit() ? Translator.i18n('POPUPS_DOMAIN/TITLE_EDIT_DOMAIN', {'NAME': sName}) :
|
||||
('' === sName ? Translator.i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN') :
|
||||
Translator.i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN_WITH_NAME', {'NAME': sName}));
|
||||
}, this);
|
||||
|
||||
this.domainIsComputed = ko.computed(function () {
|
||||
|
|
@ -348,12 +351,12 @@
|
|||
}
|
||||
else if (Enums.Notification.DomainAlreadyExists === oData.ErrorCode)
|
||||
{
|
||||
this.savingError('Domain already exists');
|
||||
this.savingError(Translator.i18n('ERRORS/DOMAIN_ALREADY_EXISTS'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.savingError('Unknown error');
|
||||
this.savingError(Translator.i18n('ERRORS/UNKNOWN_ERROR'));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -21,54 +21,26 @@
|
|||
{
|
||||
AbstractView.call(this, 'Popups', 'PopupsLanguages');
|
||||
|
||||
this.LanguageStore = require('Stores/Language');
|
||||
var self = this;
|
||||
|
||||
this.exp = ko.observable(false);
|
||||
this.fLang = null;
|
||||
this.sUserLanguage = '';
|
||||
|
||||
this.langs = ko.observableArray([]);
|
||||
|
||||
this.languages = ko.computed(function () {
|
||||
return _.map(this.LanguageStore.languages(), function (sLanguage) {
|
||||
return _.map(self.langs(), function (sLanguage) {
|
||||
return {
|
||||
'key': sLanguage,
|
||||
'user': sLanguage === self.sUserLanguage,
|
||||
'selected': ko.observable(false),
|
||||
'fullName': Utils.convertLangName(sLanguage)
|
||||
};
|
||||
});
|
||||
}, this);
|
||||
});
|
||||
|
||||
this.languagesTop = ko.computed(function () {
|
||||
|
||||
var
|
||||
aTop = this.LanguageStore.languagesTop(),
|
||||
aLangs = this.languages()
|
||||
;
|
||||
|
||||
return 0 < aTop.length ? _.compact(_.map(aTop, function (sLang) {
|
||||
return _.find(aLangs, function (aItem) {
|
||||
return aItem && sLang === aItem.key;
|
||||
});
|
||||
})) : [];
|
||||
}, this);
|
||||
|
||||
this.languagesBottom = ko.computed(function () {
|
||||
|
||||
var
|
||||
aTop = this.languagesTop(),
|
||||
aLangs = this.languages()
|
||||
;
|
||||
|
||||
if (0 < aTop.length)
|
||||
{
|
||||
return _.filter(aLangs, function (aItem) {
|
||||
return -1 === Utils.inArray(aItem, aTop);
|
||||
});
|
||||
}
|
||||
|
||||
return aLangs;
|
||||
|
||||
}, this);
|
||||
|
||||
this.LanguageStore.language.subscribe(function () {
|
||||
this.resetMainLanguage();
|
||||
this.langs.subscribe(function () {
|
||||
this.setLanguageSelection();
|
||||
}, this);
|
||||
|
||||
kn.constructorEnd(this);
|
||||
|
|
@ -77,35 +49,42 @@
|
|||
kn.extendAsViewModel(['View/Popup/Languages', 'PopupsLanguagesViewModel'], LanguagesPopupView);
|
||||
_.extend(LanguagesPopupView.prototype, AbstractView.prototype);
|
||||
|
||||
LanguagesPopupView.prototype.languageEnName = function (sLanguage)
|
||||
LanguagesPopupView.prototype.languageTooltipName = function (sLanguage)
|
||||
{
|
||||
var sResult = Utils.convertLangName(sLanguage, true);
|
||||
return 'English' === sResult ? '' : sResult;
|
||||
return Utils.convertLangName(sLanguage, false) === sResult ? '' : sResult;
|
||||
};
|
||||
|
||||
LanguagesPopupView.prototype.resetMainLanguage = function ()
|
||||
LanguagesPopupView.prototype.setLanguageSelection = function ()
|
||||
{
|
||||
var sCurrent = this.LanguageStore.language();
|
||||
var sCurrent = this.fLang ? ko.unwrap(this.fLang) : '';
|
||||
_.each(this.languages(), function (oItem) {
|
||||
oItem['selected'](oItem['key'] === sCurrent);
|
||||
});
|
||||
};
|
||||
|
||||
LanguagesPopupView.prototype.onShow = function ()
|
||||
LanguagesPopupView.prototype.onShow = function (fLanguage, aLangs, sUserLanguage)
|
||||
{
|
||||
this.exp(true);
|
||||
this.fLang = fLanguage;
|
||||
this.sUserLanguage = sUserLanguage || '';
|
||||
|
||||
this.resetMainLanguage();
|
||||
this.langs(aLangs);
|
||||
};
|
||||
|
||||
LanguagesPopupView.prototype.onHide = function ()
|
||||
{
|
||||
this.exp(false);
|
||||
this.fLang = null;
|
||||
this.sUserLanguage = '';
|
||||
this.langs([]);
|
||||
};
|
||||
|
||||
LanguagesPopupView.prototype.changeLanguage = function (sLang)
|
||||
{
|
||||
this.LanguageStore.language(sLang);
|
||||
if (this.fLang)
|
||||
{
|
||||
this.fLang(sLang);
|
||||
}
|
||||
|
||||
this.cancelCommand();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
this.readmePopoverConf = {
|
||||
'placement': 'top',
|
||||
'trigger': 'hover',
|
||||
'title': 'About',
|
||||
'title': Translator.i18n('POPUPS_PLUGIN/TOOLTIP_ABOUT_TITLE'),
|
||||
'container': 'body',
|
||||
'content': function () {
|
||||
return self.readme();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
var
|
||||
window = require('window'),
|
||||
_ = require('_'),
|
||||
$ = require('$'),
|
||||
ko = require('ko'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
|
|
@ -94,6 +93,7 @@
|
|||
|
||||
this.langRequest = ko.observable(false);
|
||||
this.language = LanguageStore.language;
|
||||
this.languages = LanguageStore.languages;
|
||||
|
||||
this.bSendLanguage = false;
|
||||
|
||||
|
|
@ -176,7 +176,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
require('App/User').loginAndLogoutReload();
|
||||
require('App/User').loginAndLogoutReload(false);
|
||||
}
|
||||
}
|
||||
else if (oData.ErrorCode)
|
||||
|
|
@ -318,11 +318,6 @@
|
|||
{
|
||||
this.emailFocus(true);
|
||||
}
|
||||
|
||||
if (Settings.settingsGet('UserLanguage'))
|
||||
{
|
||||
$.cookie('rllang', LanguageStore.language(), {'expires': 30});
|
||||
}
|
||||
};
|
||||
|
||||
LoginUserView.prototype.onHide = function ()
|
||||
|
|
@ -344,7 +339,7 @@
|
|||
if (0 === iErrorCode)
|
||||
{
|
||||
self.submitRequest(true);
|
||||
require('App/User').loginAndLogoutReload();
|
||||
require('App/User').loginAndLogoutReload(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -406,10 +401,9 @@
|
|||
|
||||
self.langRequest(true);
|
||||
|
||||
Translator.reload(sValue, function() {
|
||||
Translator.reload(false, sValue, function() {
|
||||
self.langRequest(false);
|
||||
self.bSendLanguage = true;
|
||||
$.cookie('rllang', sValue, {'expires': 30});
|
||||
}, function() {
|
||||
self.langRequest(false);
|
||||
});
|
||||
|
|
@ -427,7 +421,9 @@
|
|||
|
||||
LoginUserView.prototype.selectLanguage = function ()
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/Languages'));
|
||||
kn.showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.language, this.languages(), LanguageStore.userLanguage()
|
||||
]);
|
||||
};
|
||||
|
||||
module.exports = LoginUserView;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue