Redesign language switcher with circular flag icons
Desktop dropdown and mobile modal now show circular country flags (flag-icons) with clean language names and an active-language highlight, driven by the page lang via main.js. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
44433d4145
commit
95b2484117
182 files changed
+1294
-1095
No files matched your search
@@ -122,10 +122,12 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
pathWithoutLang = path;
|
||||
}
|
||||
|
||||
const docLang = (document.documentElement.getAttribute('lang') || 'en').toLowerCase();
|
||||
document.querySelectorAll('a[data-lang]').forEach(link => {
|
||||
const targetLang = link.getAttribute('data-lang');
|
||||
const newUrl = `/${targetLang}${pathWithoutLang}`;
|
||||
link.setAttribute('href', newUrl.replace(/\/{2,}/g, '/'));
|
||||
link.classList.toggle('is-current', targetLang === docLang);
|
||||
});
|
||||
|
||||
const desktopSelectors = document.querySelectorAll('.header-right-wrapper .language-selector');
|
||||
|
||||
Reference in new issue
Block a user