fix: traduire en français les libellés des dcc.Dropdown (#101)

Dash 4 introduit le prop labels sur dcc.Dropdown ("Select all",
"Deselect all", placeholder "Search", etc.). Ajout d'un dict partagé
DROPDOWN_LABELS_FR (src/utils/frontend.py) appliqué aux 11 dcc.Dropdown
de l'app (observatoire.py, acheteur.py, titulaire.py).
This commit is contained in:
Colin Maudry
2026-07-09 17:41:05 +02:00
parent 07bb4a91d0
commit 9cf065e0db
4 changed files with 24 additions and 3 deletions
+2 -1
View File
@@ -24,7 +24,7 @@ from src.figures import (
make_column_picker, make_column_picker,
) )
from src.utils.data import DF_ACHETEURS, get_annuaire_data, get_departement_region from src.utils.data import DF_ACHETEURS, get_annuaire_data, get_departement_region
from src.utils.frontend import get_button_properties from src.utils.frontend import DROPDOWN_LABELS_FR, get_button_properties
from src.utils.seo import META_CONTENT from src.utils.seo import META_CONTENT
from src.utils.table import ( from src.utils.table import (
COLUMNS, COLUMNS,
@@ -117,6 +117,7 @@ layout = [
) )
], ],
placeholder="Année", placeholder="Année",
labels=DROPDOWN_LABELS_FR,
), ),
width=4, width=4,
), ),
+10 -1
View File
@@ -37,7 +37,7 @@ from src.utils.data import (
DF_TITULAIRES, DF_TITULAIRES,
prepare_dashboard_data, prepare_dashboard_data,
) )
from src.utils.frontend import get_enum_values_as_dict from src.utils.frontend import DROPDOWN_LABELS_FR, get_enum_values_as_dict
from src.utils.seo import META_CONTENT from src.utils.seo import META_CONTENT
from src.utils.table import ( from src.utils.table import (
COLUMNS, COLUMNS,
@@ -149,6 +149,7 @@ Alors, on fait comment ?
placeholder="12 derniers mois", placeholder="12 derniers mois",
persistence=True, persistence=True,
persistence_type="local", persistence_type="local",
labels=DROPDOWN_LABELS_FR,
), ),
), ),
), ),
@@ -175,6 +176,7 @@ Alors, on fait comment ?
placeholder="Catégorie", placeholder="Catégorie",
persistence=True, persistence=True,
persistence_type="local", persistence_type="local",
labels=DROPDOWN_LABELS_FR,
) )
), ),
), ),
@@ -188,6 +190,7 @@ Alors, on fait comment ?
options=OPTIONS_DEPARTEMENTS, options=OPTIONS_DEPARTEMENTS,
persistence=True, persistence=True,
persistence_type="local", persistence_type="local",
labels=DROPDOWN_LABELS_FR,
), ),
), ),
), ),
@@ -214,6 +217,7 @@ Alors, on fait comment ?
), ),
persistence=True, persistence=True,
persistence_type="local", persistence_type="local",
labels=DROPDOWN_LABELS_FR,
), ),
), ),
), ),
@@ -227,6 +231,7 @@ Alors, on fait comment ?
options=OPTIONS_DEPARTEMENTS, options=OPTIONS_DEPARTEMENTS,
persistence=True, persistence=True,
persistence_type="local", persistence_type="local",
labels=DROPDOWN_LABELS_FR,
), ),
), ),
), ),
@@ -239,6 +244,7 @@ Alors, on fait comment ?
options=get_enum_values_as_dict("type"), options=get_enum_values_as_dict("type"),
persistence=True, persistence=True,
persistence_type="local", persistence_type="local",
labels=DROPDOWN_LABELS_FR,
), ),
), ),
), ),
@@ -318,6 +324,7 @@ Alors, on fait comment ?
multi=True, multi=True,
persistence=True, persistence=True,
persistence_type="local", persistence_type="local",
labels=DROPDOWN_LABELS_FR,
), ),
), ),
), ),
@@ -390,6 +397,7 @@ Alors, on fait comment ?
multi=True, multi=True,
persistence=True, persistence=True,
persistence_type="local", persistence_type="local",
labels=DROPDOWN_LABELS_FR,
), ),
), ),
), ),
@@ -404,6 +412,7 @@ Alors, on fait comment ?
), ),
persistence=True, persistence=True,
persistence_type="local", persistence_type="local",
labels=DROPDOWN_LABELS_FR,
), ),
), ),
), ),
+2 -1
View File
@@ -23,7 +23,7 @@ from src.figures import (
make_column_picker, make_column_picker,
) )
from src.utils.data import DF_TITULAIRES, get_annuaire_data, get_departement_region from src.utils.data import DF_TITULAIRES, get_annuaire_data, get_departement_region
from src.utils.frontend import get_button_properties from src.utils.frontend import DROPDOWN_LABELS_FR, get_button_properties
from src.utils.seo import META_CONTENT from src.utils.seo import META_CONTENT
from src.utils.table import ( from src.utils.table import (
COLUMNS, COLUMNS,
@@ -122,6 +122,7 @@ layout = [
) )
], ],
placeholder="Année", placeholder="Année",
labels=DROPDOWN_LABELS_FR,
), ),
width=4, width=4,
), ),
+10
View File
@@ -2,6 +2,16 @@ from datetime import datetime
from src.utils.data import DATA_SCHEMA from src.utils.data import DATA_SCHEMA
DROPDOWN_LABELS_FR = {
"select_all": "Tout sélectionner",
"deselect_all": "Tout désélectionner",
"selected_count": "{num_selected} sélectionné(s)",
"search": "Rechercher...",
"clear_search": "Effacer la recherche",
"clear_selection": "Effacer la sélection",
"no_options_found": "Aucun résultat",
}
def format_date_french(date_input) -> str: def format_date_french(date_input) -> str:
"""Format a date as 'jour mois' (e.g., '1er janvier', '15 décembre').""" """Format a date as 'jour mois' (e.g., '1er janvier', '15 décembre')."""