mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 04:05:40 +01:00
update for setting languages on cookies.
This commit is contained in:
parent
e77fb427ae
commit
5acf9ea114
@ -9,7 +9,9 @@
|
||||
I18nService.$inject = ['$cookies', '$window'];
|
||||
|
||||
function I18nService($cookies, $window) {
|
||||
|
||||
var cookieOptions = {'path': '/'};
|
||||
|
||||
var messages = $.extend(true, {}, eval('locale_messages'));
|
||||
var defaultLanguage = navigator.language || 'en-US';
|
||||
var supportLanguages = {
|
||||
@ -24,6 +26,7 @@
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
return tr;
|
||||
function tr() {
|
||||
@ -33,9 +36,11 @@
|
||||
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() {
|
||||
|
Loading…
Reference in New Issue
Block a user