update for setting languages on cookies.

This commit is contained in:
kunw 2016-06-22 19:25:23 +08:00
parent e77fb427ae
commit 5acf9ea114

View File

@ -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() {