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

View File

@@ -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

View File

@@ -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;
}
}
})();

View File

@@ -7,7 +7,11 @@
{{ $pageLink := replace (replace $context.RelPermalink (add $pageLang "/") "") $base.Path "/" }}
{{ 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 }}
{{ if eq (string $pageLang) (string .Language) }}
<option