mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 12:15:20 +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 = {
|
||||
@ -25,6 +27,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