commit
9bfb38d819
2 changed files with 13 additions and 24 deletions
|
|
@ -22,7 +22,7 @@ angular.module('copayApp.controllers').controller('preferencesLanguageController
|
||||||
if (err) $log.warn(err);
|
if (err) $log.warn(err);
|
||||||
|
|
||||||
$ionicHistory.goBack();
|
$ionicHistory.goBack();
|
||||||
uxLanguage.update(function() {
|
uxLanguage.init(function() {
|
||||||
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
|
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
|
||||||
$log.debug('Remote preferences saved');
|
$log.debug('Remote preferences saved');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
@ -95,31 +96,19 @@ angular.module('copayApp.services')
|
||||||
return root.availableLanguages;
|
return root.availableLanguages;
|
||||||
};
|
};
|
||||||
|
|
||||||
root.init = function() {
|
root.init = function(cb) {
|
||||||
root._detect(function(lang) {
|
configService.whenAvailable(function(config) {
|
||||||
root._set(lang);
|
var userLang = config.wallet.settings.defaultLanguage;
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
root.update = function(cb) {
|
if (userLang && userLang != root.currentLanguage) {
|
||||||
var userLang = configService.getSync().wallet.settings.defaultLanguage;
|
|
||||||
|
|
||||||
if (!userLang) {
|
|
||||||
root._detect(function(lang) {
|
|
||||||
userLang = lang;
|
|
||||||
|
|
||||||
if (userLang != root.currentLanguage) {
|
|
||||||
root._set(lang);
|
|
||||||
}
|
|
||||||
if (cb) return cb(userLang);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (userLang != root.currentLanguage) {
|
|
||||||
root._set(userLang);
|
root._set(userLang);
|
||||||
|
} else {
|
||||||
|
root._detect(function(lang) {
|
||||||
|
root._set(lang);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
if (cb) return cb();
|
||||||
if (cb) return cb(userLang);
|
});
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
root.getName = function(lang) {
|
root.getName = function(lang) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue