Skip to content

Commit

Permalink
solve bug related to "Error in the homepage in the UI (registers not …
Browse files Browse the repository at this point in the history
…listed)" Issue #50
  • Loading branch information
emanuelaepure10 committed Jun 15, 2021
1 parent 55dabe1 commit 70fb064
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions dist/webapp/public_html/js/app_i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,20 @@ var i18n;
* @param {type} selector
*/
function initLocalization(selector) {

let storedLanguage = val_emptyString;

// checking if there is the language passed by URL
if (languageFromUrl !== null && languageFromUrl.length === 2) {

currentLanguage = languageFromUrl;
} else {

// Checking if there is a language stored in the cookies
if (navigator.cookieEnabled) {

// Getting the language stored in the cookie
storedLanguage = getCookie(key_cookieName_language);
}

let fallbackLang = getBrowserLanguage();
if(selector !== val_emptyString || typeof selector === val_undefined || selector === val_emptyString){
fallbackLang = $(selector).attr('hreflang');
}

// Takes the cookie stored language if available, otherwise the default
currentLanguage = (storedLanguage !== val_emptyString && typeof storedLanguage !== val_undefined && storedLanguage !== null) ? storedLanguage : fallbackLang;

// Takes the cookie stored language if available, otherwise the default
currentLanguage = (storedLanguage !== val_emptyString && storedLanguage !== "undefined") ? storedLanguage : getBrowserLanguage();
}

// Storing the language to the cookie if needed
Expand All @@ -80,6 +71,7 @@ function initLocalization(selector) {

// Loading the localization file for the current language
loadI18nFile(currentLanguage);

// Iinitializing the page elements with the language
refreshSelectedLanguages(selector);
}
Expand Down

0 comments on commit 70fb064

Please sign in to comment.