diff --git a/root/usr/share/smanager/themes/AdminLTE/public/koozali/js/flag-by-locale.js b/root/usr/share/smanager/themes/AdminLTE/public/koozali/js/flag-by-locale.js index 7cc4348..b48aafb 100644 --- a/root/usr/share/smanager/themes/AdminLTE/public/koozali/js/flag-by-locale.js +++ b/root/usr/share/smanager/themes/AdminLTE/public/koozali/js/flag-by-locale.js @@ -208,7 +208,7 @@ document.addEventListener('DOMContentLoaded', () => { //if (!response.ok) throw new Error('Country not found'); //const data = await response.json(); //// Return the name in the native language - //return data[0].name.common; + //return data[0].name.common; //} catch (error) { //console.error(error); //return 'Unknown Country'; @@ -222,7 +222,7 @@ document.addEventListener('DOMContentLoaded', () => { function getCountryCodeFromLanguage(language) { return languageToCountryMap[language] ? languageToCountryMap[language].code : null; } - + function getCountryNameFromCountryCode(countryCode) { //alert(`Country code: ${countryCode}`); for (const language in languageToCountryMap) { @@ -263,11 +263,15 @@ document.addEventListener('DOMContentLoaded', () => { function displayLocaleAndFlag() { // Get the browser locale - const userLocale = navigator.language || navigator.userLanguage; + const userLocale = navigator.languages && navigator.languages.length + ? navigator.languages[0] + : navigator.language; + //alert(`User Locale: ${userLocale}`); // Alert the detected locale + //console.log(navigator.languages); // Log language to console const { flag, isUnknown, countryCode } = getFlagEmoji(userLocale); - + //alert(`Country Code: ${countryCode}, Is Unknown: ${isUnknown}`); // Debug country code and unknown flag status // Display the locale and the corresponding flag (or fallback) @@ -278,7 +282,7 @@ function displayLocaleAndFlag() { fallbackDiv.className = 'fallback-box'; fallbackDiv.textContent = `? ${userLocale.toUpperCase()}`; // Show ? and locale code inside the box document.getElementById('flag-container').appendChild(fallbackDiv); - + // Tooltip for fallback fallbackDiv.title = "Unknown Country"; // Tooltip for fallback //alert('Fallback triggered: Unknown Country'); // Debug fallback @@ -290,7 +294,7 @@ function displayLocaleAndFlag() { flagSpan.textContent = flag; // Use flag emoji flagSpan.title = countryName; // Tooltip for the flag in country language document.getElementById('flag-container').appendChild(flagSpan); - + //alert(`Flag Emoji: ${flag}`); // Debug flag emoji display } } diff --git a/root/usr/share/smanager/themes/AdminLTE/templates/remoteaccess.html.ep b/root/usr/share/smanager/themes/AdminLTE/templates/remoteaccess.html.ep index f7e517c..35b575b 100644 --- a/root/usr/share/smanager/themes/AdminLTE/templates/remoteaccess.html.ep +++ b/root/usr/share/smanager/themes/AdminLTE/templates/remoteaccess.html.ep @@ -24,12 +24,13 @@ <% my $btn = l('SAVE'); %> - +