reload systeminfo after language change

This commit is contained in:
agrajaghh
2016-10-06 12:37:34 +02:00
parent e535f0cdc0
commit d841bc43f8
@@ -43,12 +43,12 @@ backupApp.service('SystemInfo', function($rootScope, $timeout, $cookies, AppServ
function reloadTexts() {
state.backendgroups = this.backendgroups = {
std: {
'ftp': null,
'ssh': null,
'webdav': null,
'openstack': gettextCatalog.getString('OpenStack Object Storage / Swift'),
's3': gettextCatalog.getString('S3 Compatible'),
std: {
'ftp': null,
'ssh': null,
'webdav': null,
'openstack': gettextCatalog.getString('OpenStack Object Storage / Swift'),
's3': gettextCatalog.getString('S3 Compatible'),
'aftp': gettextCatalog.getString('FTP (Alternative)')
},
local: {'file': null},
@@ -107,21 +107,24 @@ backupApp.service('SystemInfo', function($rootScope, $timeout, $cookies, AppServ
this.notifyChanged = function() {
$rootScope.$broadcast('systeminfochanged');
};
uiLanguage = $cookies.get('ui-locale');
if ((uiLanguage || '').trim().length == 0) {
gettextCatalog.setCurrentLanguage(state.BrowserLocale.Code.replace("-", "_"));
} else {
gettextCatalog.setCurrentLanguage(uiLanguage);
}
AppService.get('/systeminfo').then(function(data) {
function loadSystemInfo() {
AppService.get('/systeminfo').then(function(data) {
angular.copy(data.data, state);
angular.copy(data.data, state);
uiLanguage = $cookies.get('ui-locale');
if ((uiLanguage || '').trim().length == 0) {
gettextCatalog.setCurrentLanguage(state.BrowserLocale.Code.replace("-", "_"));
} else {
gettextCatalog.setCurrentLanguage(uiLanguage);
}
reloadTexts();
reloadBackendConfig();
$rootScope.$broadcast('systeminfochanged');
}, AppUtils.connectionError)
reloadTexts();
reloadBackendConfig();
$rootScope.$broadcast('systeminfochanged');
}, AppUtils.connectionError)
}
loadSystemInfo();
$rootScope.$on('gettextLanguageChanged', loadSystemInfo);
});