mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
update on switching langanges of UI.
This commit is contained in:
parent
5acf9ea114
commit
169ebf0ee4
@ -14,13 +14,15 @@
|
||||
vm.currentLanguage = I18nService().getCurrentLanguage();
|
||||
vm.languageName = I18nService().getLanguageName(vm.currentLanguage);
|
||||
|
||||
I18nService().setCurrentLanguage(vm.currentLanguage);
|
||||
|
||||
console.log('current language:' + vm.languageName);
|
||||
|
||||
vm.supportLanguages = I18nService().getSupportLanguages();
|
||||
vm.user = currentUser.get();
|
||||
vm.setLanguage = setLanguage;
|
||||
vm.logOut = logOut;
|
||||
|
||||
|
||||
function setLanguage(language) {
|
||||
I18nService().setCurrentLanguage(language);
|
||||
$window.location.href = '/language?lang=' + language;
|
||||
|
@ -13,7 +13,7 @@
|
||||
var cookieOptions = {'path': '/'};
|
||||
|
||||
var messages = $.extend(true, {}, eval('locale_messages'));
|
||||
var defaultLanguage = navigator.language || 'en-US';
|
||||
var defaultLanguage = 'en-US';
|
||||
var supportLanguages = {
|
||||
'en-US': 'English',
|
||||
'zh-CN': '中文'
|
||||
@ -36,11 +36,9 @@
|
||||
if(!angular.isDefined(language) || !isSupportLanguage(language)) {
|
||||
language = defaultLanguage;
|
||||
}
|
||||
$cookies.remove('language', cookieOptions);
|
||||
$cookies.put('language', language, cookieOptions);
|
||||
},
|
||||
'setDefaultLanguage': function() {
|
||||
$cookies.remove('language', cookieOptions);
|
||||
$cookies.put('language', defaultLanguage, cookieOptions);
|
||||
},
|
||||
'getCurrentLanguage': function() {
|
||||
@ -50,6 +48,7 @@
|
||||
if(!angular.isDefined(language) || !isSupportLanguage(language)) {
|
||||
language = defaultLanguage;
|
||||
}
|
||||
$cookies.put('language', language, cookieOptions);
|
||||
return supportLanguages[language];
|
||||
},
|
||||
'getSupportLanguages': function() {
|
||||
|
Loading…
Reference in New Issue
Block a user