feat(lang): routage préfixé /fr/ et /en/ avec redirect JS langue sur les chemins non préfixés

- page-redirect sur / et tous les chemins sans préfixe : localStorage zektyc-lang
  puis navigator.language, défaut fr ; fallback FR si la page n'a pas de version EN
- /en/ sert enfin la home EN (public/en/), fix de LANG_ROUTES.en
- home EN générée à partir d'i18n.json (ld+json Organization/FAQPage valides)
- i18n.js/components.js : switch de langue par préfixe + liens préfixés
- anciennes URLs /zmap/en/* : 301 vers /en/zmap/* ; pages EN zmap déplacées
  vers le layout <page>/en/ standard
- canonicals/hreflang fr-en-x-default sur toutes les pages statiques + sitemaps
  (équipe, zmap, archives, vitesses-par-route ajoutées) ; suppression du domaine
  obsolète zektyc.duckdns.org (robots, sitemap index, security.txt)
This commit is contained in:
riricdev 2026-09-06 16:12:16 +02:00
commit 370b3d8752
30 changed files with 566 additions and 124 deletions

View file

@ -113,18 +113,13 @@
try {
localStorage.setItem(STORAGE_KEY, lang)
} catch (err) {}
apply(lang)
var currentPath = window.location.pathname
var isHome = currentPath === "/" || currentPath === "/index.html" || currentPath === "/en/" || currentPath === "/en/index.html"
if (isHome) {
var newUrl = lang === "fr" ? "/" : "/en/"
if (currentPath !== newUrl) history.pushState(null, "", newUrl)
return
var target = currentPath
if (/^\/fr(\/|$)/.test(currentPath) || /^\/en(\/|$)/.test(currentPath)) {
target = "".concat("/", lang, currentPath.slice(3))
}
var target = "/" + lang + "/" + (window.location.hash || "")
if (window.location.pathname !== "/" + lang + "/") {
if (window.location.pathname !== target) {
window.location.href = target
}
})