Ajoute la redirection vers la page d'accueil spécifique à la langue en fonction de la langue du navigateur
This commit is contained in:
@@ -1,6 +1,20 @@
|
|||||||
// main script
|
// main script
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
(function() {
|
||||||
|
// Redirect to language-specific homepage based on browser language, default to English
|
||||||
|
var supportedLangs = ['fr', 'nl'];
|
||||||
|
var userLang = navigator.language || navigator.userLanguage;
|
||||||
|
|
||||||
|
userLang = userLang.split('-')[0];
|
||||||
|
var currentPath = window.location.pathname;
|
||||||
|
var alreadyLang = supportedLangs.some(function(lang) {
|
||||||
|
return currentPath.startsWith('/' + lang + '/');
|
||||||
|
});
|
||||||
|
if (supportedLangs.includes(userLang) && !alreadyLang) {
|
||||||
|
window.location.href = '/' + userLang + '/';
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
// Dropdown Menu Toggler For Mobile
|
// Dropdown Menu Toggler For Mobile
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user