.
This commit is contained in:
parent
071a4d8a97
commit
4d3ca1c554
39 changed files with 3386 additions and 0 deletions
23
static/js/language.js
Normal file
23
static/js/language.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Only run on the home page to avoid redirect loops
|
||||
if (window.location.pathname === '/') {
|
||||
const userLang = navigator.language || navigator.userLanguage;
|
||||
const currentLang = document.documentElement.lang;
|
||||
|
||||
// Simple language mapping
|
||||
const supportedLanguages = {
|
||||
'de': '/de/',
|
||||
'de-DE': '/de/',
|
||||
'de-AT': '/de/',
|
||||
'de-CH': '/de/',
|
||||
'en': '/en/',
|
||||
'en-US': '/en/',
|
||||
'en-GB': '/en/'
|
||||
};
|
||||
|
||||
// Check if user's language is different from current and is supported
|
||||
if (supportedLanguages[userLang] && currentLang !== userLang.substring(0,2)) {
|
||||
window.location.href = supportedLanguages[userLang];
|
||||
}
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue