fix language

This commit is contained in:
Javier 2016-09-05 11:25:30 -03:00
parent 22c06c73a3
commit 50c30c25ec
1 changed files with 15 additions and 5 deletions

View File

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services')
.factory('uxLanguage', function languageService($log, lodash, gettextCatalog, amMoment, configService) {
.factory('uxLanguage', function languageService($log, $timeout, lodash, gettextCatalog, amMoment, configService) {
var root = {};
root.currentLanguage = null;
@ -73,6 +73,7 @@ angular.module('copayApp.services')
$log.debug('Setting default language: ' + lang);
gettextCatalog.setCurrentLanguage(lang);
root.currentLanguage = lang;
if (lang == 'zh') lang = lang + '-CN'; // Fix for Chinese Simplified
amMoment.changeLocale(lang);
};
@ -96,9 +97,18 @@ angular.module('copayApp.services')
};
root.init = function() {
root._detect(function(lang) {
root._set(lang);
});
$timeout(function() {
var userLang = configService.getSync().wallet.settings.defaultLanguage;
if (userLang && userLang != root.currentLanguage) {
root._set(userLang);
return;
}
root._detect(function(lang) {
root._set(lang);
});
}, 100);
};
root.update = function(cb) {