From 2fce96f794ba63fcf8974f2b7eb1e589b6d1b491 Mon Sep 17 00:00:00 2001 From: Boris Waaub Date: Mon, 19 Jan 2026 16:52:36 +0100 Subject: [PATCH] =?UTF-8?q?Refonte=20de=20la=20navigation=20en=20fran?= =?UTF-8?q?=C3=A7ais=20et=20am=C3=A9lioration=20de=20la=20redirection=20li?= =?UTF-8?q?nguistique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/_default/menus.fr.toml | 130 ++++++++++-------- themes/hugoplate/assets/js/main.js | 21 +-- .../components/language-switcher.html | 6 +- 3 files changed, 85 insertions(+), 72 deletions(-) diff --git a/config/_default/menus.fr.toml b/config/_default/menus.fr.toml index 3bd149e..155cbf4 100755 --- a/config/_default/menus.fr.toml +++ b/config/_default/menus.fr.toml @@ -1,90 +1,98 @@ -############# French navigation ############## +############# French navigation adaptée à menu.yml ############## [[main]] name = "Fonctionnalités" +hasChildren = true +weight = 1 + +[[main]] +parent = "Fonctionnalités" +name = "Aperçu" url = "presentation/" -weight = 2 - -[[main]] -parent = "Fonctionnalités" -name = "Suivi des usagers" -url = "presentation/persons" weight = 1 [[main]] parent = "Fonctionnalités" -name = "Suivi des accompagnements" -url = "presentation/accompanying-courses" -weight = 2 - -[[main]] -parent = "Fonctionnalités" -name = "Suivi des décisions" -url = "presentation/workflow" -weight = 3 - -[[main]] -parent = "Fonctionnalités" -name = "Génération de documents" -url = "presentation/doc-generation" -weight = 4 - -[[main]] -parent = "Fonctionnalités" -name = "Export des statistiques" -url = "presentation/export-stats" -weight = 5 - -[[main]] -parent = "Fonctionnalités" -name = "Feuille de route" +name = "Mises à jour" url = "presentation/roadmap" -weight = 6 - -############# - -[[main]] -name = "Pour commencer" -hasChildren = true -weight = 3 - -[[main]] -parent = "Pour commencer" -name = "Comme utilisateur" -url = "start/user" -weight = 1 - -[[main]] -parent = "Pour commencer" -name = "Comme développeur" -url = "start/developper" weight = 2 ############# [[main]] -name = "Obtenir Chill" +name = "Formules" +hasChildren = true +weight = 2 + +[[main]] +parent = "Formules" +name = "Tarifs" +url = "get-chill/tarifs" +weight = 1 + +[[main]] +parent = "Formules" +name = "Les formations" +url = "get-chill/formations" +weight = 2 + +############# + +[[main]] +name = "Installer" +hasChildren = true +weight = 3 + +[[main]] +parent = "Installer" +name = "Seul" +url = "get-chill/install" +weight = 1 + +[[main]] +parent = "Installer" +name = "Via un prestataire" +url = "get-chill/providers" +weight = 2 + +############# + +[[main]] +name = "Ressources" hasChildren = true weight = 4 [[main]] -parent = "Obtenir Chill" -url = "get-chill/install" -name = "Installer Chill" +parent = "Ressources" +name = "Documentation technique" +url = "docs/technique" weight = 1 [[main]] -parent = "Obtenir Chill" -url = "get-chill/configuration" -name = "Support à la configuration" +parent = "Ressources" +name = "Code source" +url = "https://gitea.champs-libres.be/Chill-project/chill" weight = 2 [[main]] -parent = "Obtenir Chill" -url = "get-chill/providers" -name = "Trouver un prestataire" +parent = "Ressources" +name = "Tickets Chill Bundles" +url = "https://gitea.champs-libres.be/Chill-project/bundles/issues" weight = 3 +[[main]] +parent = "Ressources" +name = "Manuels" +url = "https://gitea.champs-libres.be/Chill-project/manuals/releases" +weight = 4 + +############# + +[[main]] +name = "Nous contacter" +url = "contact/" +weight = 5 + ############# # footer menu diff --git a/themes/hugoplate/assets/js/main.js b/themes/hugoplate/assets/js/main.js index c806382..677dda6 100755 --- a/themes/hugoplate/assets/js/main.js +++ b/themes/hugoplate/assets/js/main.js @@ -2,17 +2,18 @@ (function () { "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 supportedLangs = ['fr', 'nl']; // Liste des langues supportées + var storedLang = localStorage.getItem('preferredLang'); + var navigatorLang = (navigator.language || navigator.userLanguage).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 + '/'; + + // Redirige vers la langue stockée si présente, sinon vers la langue du navigateur + if (currentPath === '/') { + if (storedLang && storedLang !== '') { + window.location.href = '/' + storedLang; + } else if (supportedLangs.includes(navigatorLang)) { + window.location.href = '/' + navigatorLang; + } } })(); diff --git a/themes/hugoplate/layouts/partials/components/language-switcher.html b/themes/hugoplate/layouts/partials/components/language-switcher.html index 229f493..5d0b1de 100644 --- a/themes/hugoplate/layouts/partials/components/language-switcher.html +++ b/themes/hugoplate/layouts/partials/components/language-switcher.html @@ -7,7 +7,11 @@ {{ $pageLink := replace (replace $context.RelPermalink (add $pageLang "/") "") $base.Path "/" }} {{ if $context.IsTranslated }} - {{ range $siteLanguages }} {{ if eq (string $pageLang) (string .Language) }}