fix language
This commit is contained in:
parent
22c06c73a3
commit
50c30c25ec
1 changed files with 15 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
angular.module('copayApp.services')
|
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 = {};
|
var root = {};
|
||||||
|
|
||||||
root.currentLanguage = null;
|
root.currentLanguage = null;
|
||||||
|
|
@ -72,7 +72,8 @@ angular.module('copayApp.services')
|
||||||
root._set = function(lang) {
|
root._set = function(lang) {
|
||||||
$log.debug('Setting default language: ' + lang);
|
$log.debug('Setting default language: ' + lang);
|
||||||
gettextCatalog.setCurrentLanguage(lang);
|
gettextCatalog.setCurrentLanguage(lang);
|
||||||
root.currentLanguage = lang;
|
root.currentLanguage = lang;
|
||||||
|
|
||||||
if (lang == 'zh') lang = lang + '-CN'; // Fix for Chinese Simplified
|
if (lang == 'zh') lang = lang + '-CN'; // Fix for Chinese Simplified
|
||||||
amMoment.changeLocale(lang);
|
amMoment.changeLocale(lang);
|
||||||
};
|
};
|
||||||
|
|
@ -96,9 +97,18 @@ angular.module('copayApp.services')
|
||||||
};
|
};
|
||||||
|
|
||||||
root.init = function() {
|
root.init = function() {
|
||||||
root._detect(function(lang) {
|
$timeout(function() {
|
||||||
root._set(lang);
|
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) {
|
root.update = function(cb) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue