Refonte de la navigation en français et amélioration de la redirection linguistique

This commit is contained in:
Boris Waaub
2026-01-19 16:52:36 +01:00
parent 7b724fb001
commit 2fce96f794
3 changed files with 85 additions and 72 deletions
+69 -61
View File
@@ -1,90 +1,98 @@
############# French navigation ############## ############# French navigation adaptée à menu.yml ##############
[[main]] [[main]]
name = "Fonctionnalités" name = "Fonctionnalités"
hasChildren = true
weight = 1
[[main]]
parent = "Fonctionnalités"
name = "Aperçu"
url = "presentation/" url = "presentation/"
weight = 2
[[main]]
parent = "Fonctionnalités"
name = "Suivi des usagers"
url = "presentation/persons"
weight = 1 weight = 1
[[main]] [[main]]
parent = "Fonctionnalités" parent = "Fonctionnalités"
name = "Suivi des accompagnements" name = "Mises à jour"
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"
url = "presentation/roadmap" 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 weight = 2
############# #############
[[main]] [[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 hasChildren = true
weight = 4 weight = 4
[[main]] [[main]]
parent = "Obtenir Chill" parent = "Ressources"
url = "get-chill/install" name = "Documentation technique"
name = "Installer Chill" url = "docs/technique"
weight = 1 weight = 1
[[main]] [[main]]
parent = "Obtenir Chill" parent = "Ressources"
url = "get-chill/configuration" name = "Code source"
name = "Support à la configuration" url = "https://gitea.champs-libres.be/Chill-project/chill"
weight = 2 weight = 2
[[main]] [[main]]
parent = "Obtenir Chill" parent = "Ressources"
url = "get-chill/providers" name = "Tickets Chill Bundles"
name = "Trouver un prestataire" url = "https://gitea.champs-libres.be/Chill-project/bundles/issues"
weight = 3 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 # footer menu
+11 -10
View File
@@ -2,17 +2,18 @@
(function () { (function () {
"use strict"; "use strict";
(function() { (function() {
// Redirect to language-specific homepage based on browser language, default to English var supportedLangs = ['fr', 'nl']; // Liste des langues supportées
var supportedLangs = ['fr', 'nl']; var storedLang = localStorage.getItem('preferredLang');
var userLang = navigator.language || navigator.userLanguage; var navigatorLang = (navigator.language || navigator.userLanguage).split('-')[0];
userLang = userLang.split('-')[0];
var currentPath = window.location.pathname; var currentPath = window.location.pathname;
var alreadyLang = supportedLangs.some(function(lang) {
return currentPath.startsWith('/' + lang + '/'); // Redirige vers la langue stockée si présente, sinon vers la langue du navigateur
}); if (currentPath === '/') {
if (supportedLangs.includes(userLang) && !alreadyLang) { if (storedLang && storedLang !== '') {
window.location.href = '/' + userLang + '/'; window.location.href = '/' + storedLang;
} else if (supportedLangs.includes(navigatorLang)) {
window.location.href = '/' + navigatorLang;
}
} }
})(); })();
@@ -7,7 +7,11 @@
{{ $pageLink := replace (replace $context.RelPermalink (add $pageLang "/") "") $base.Path "/" }} {{ $pageLink := replace (replace $context.RelPermalink (add $pageLang "/") "") $base.Path "/" }}
{{ if $context.IsTranslated }} {{ if $context.IsTranslated }}
<select class="{{ $class }} lang-select" onchange="location = this.value"> <select class="{{ $class }} lang-select" onchange="(function(sel){
var lang = sel.value.split('/')[1];
localStorage.setItem('preferredLang', lang);
location = sel.value;
})(this)">
{{ range $siteLanguages }} {{ range $siteLanguages }}
{{ if eq (string $pageLang) (string .Language) }} {{ if eq (string $pageLang) (string .Language) }}
<option <option