mark default language in options

This commit is contained in:
Gabriel Bazán 2015-12-21 11:31:40 -03:00
parent caa25a5124
commit 006c46c91a
2 changed files with 20 additions and 12 deletions

View File

@ -1055,9 +1055,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
};
self.setUxLanguage = function() {
var userLang = uxLanguage.update();
self.defaultLanguageIsoCode = userLang;
self.defaultLanguageName = uxLanguage.getName(userLang);
uxLanguage.update(function(lang) {
var userLang = lang;
self.defaultLanguageIsoCode = userLang;
self.defaultLanguageName = uxLanguage.getName(userLang);
});
};
self.initGlidera = function(accessToken) {
@ -1216,11 +1218,12 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
$rootScope.$on('Local/LanguageSettingUpdated', function() {
self.setUxLanguage();
self.updateRemotePreferences({
saveAll: true
}, function() {
$log.debug('Remote preferences saved')
self.setUxLanguage(function() {
self.updateRemotePreferences({
saveAll: true
}, function() {
$log.debug('Remote preferences saved')
});
});
});
@ -1391,7 +1394,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.noFocusedWallet = true;
self.isComplete = null;
self.walletName = null;
self.setUxLanguage();
self.setUxLanguage(function() {});
profileService.isDisclaimerAccepted(function(v) {
if (v) {
go.path('import');
@ -1401,7 +1404,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
$rootScope.$on('Local/NewFocusedWallet', function() {
self.setUxLanguage();
self.setUxLanguage(function() {});
self.setFocusedWallet();
self.debounceUpdateHistory();
self.isDisclaimerAccepted();

View File

@ -85,7 +85,7 @@ angular.module('copayApp.services')
});
};
root.update = function() {
root.update = function(cb) {
var userLang = configService.getSync().wallet.settings.defaultLanguage;
if (!userLang) {
@ -96,8 +96,13 @@ angular.module('copayApp.services')
if (userLang != root.currentLanguage) {
root._set(lang);
}
return userLang;
return cb(userLang);
});
} else {
if (userLang != root.currentLanguage) {
root._set(userLang);
}
return cb(userLang);
}
};