From 4ea8c90c7f498ecc9e8aab1b9b93fcb96fc5f27d Mon Sep 17 00:00:00 2001 From: Bastien Chanot Date: Sun, 12 Jul 2026 04:48:04 +0200 Subject: [PATCH] chore(i18n): drop dead dict keys, wire LanguageSwitcher through dict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6 keys unused in both dicts removed (common.back, common.none, editors.title, lateral.bilateral, lateral.unpaired, pdf.export_date_prefix). LanguageSwitcher hardcoded strings identical to existing lang.* keys — now reads them via t(); rendered output unchanged (values identical in both dicts). --- src/components/brand/LanguageSwitcher.tsx | 12 +++++++----- src/i18n/en.ts | 6 ------ src/i18n/fr.ts | 6 ------ 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/components/brand/LanguageSwitcher.tsx b/src/components/brand/LanguageSwitcher.tsx index 25325e1d..32501a87 100644 --- a/src/components/brand/LanguageSwitcher.tsx +++ b/src/components/brand/LanguageSwitcher.tsx @@ -1,14 +1,16 @@ import { useLocaleStore } from '@/state/localeStore' +import { useT } from '@/i18n/useT' import type { Locale } from '@/i18n/types' -const ITEMS: { value: Locale; label: string; ariaLabel: string }[] = [ - { value: 'fr', label: 'FR', ariaLabel: 'Passer en français' }, - { value: 'en', label: 'EN', ariaLabel: 'Switch to English' }, +const ITEMS: { value: Locale; labelKey: string; ariaKey: string }[] = [ + { value: 'fr', labelKey: 'lang.fr', ariaKey: 'lang.switch_to_fr' }, + { value: 'en', labelKey: 'lang.en', ariaKey: 'lang.switch_to_en' }, ] export default function LanguageSwitcher() { const locale = useLocaleStore((s) => s.locale) const setLocale = useLocaleStore((s) => s.setLocale) + const t = useT() return (
setLocale(item.value)} className={[ @@ -31,7 +33,7 @@ export default function LanguageSwitcher() { : 'text-[var(--color-ink)] hover:bg-[var(--color-surface-strong)]', ].join(' ')} > - {item.label} + {t(item.labelKey)} ) })} diff --git a/src/i18n/en.ts b/src/i18n/en.ts index cb39e871..b12af026 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -6,14 +6,12 @@ export const en: Dict = { 'common.confirm': 'Confirm', 'common.delete': 'Delete', 'common.add': 'Add', - 'common.back': 'Back', 'common.home': 'Home', 'common.understood': 'Got it', 'common.collapse': 'Collapse', 'common.expand': 'Expand', 'common.move_up': 'Move up', 'common.move_down': 'Move down', - 'common.none': 'None', 'common.back_to_home': 'Back to home', 'home.new_report.title': 'New report', @@ -37,7 +35,6 @@ export const en: Dict = { 'footer.in_partnership': 'In partnership with', // editors page - 'editors.title': 'Editors', 'editors.svg.title': 'SVG Editor', 'editors.svg.description': 'Annotate an anatomical SVG file: add clickable zones, categories, and FR/EN labels.', @@ -135,8 +132,6 @@ export const en: Dict = { 'lateral.both': 'Both', 'lateral.left_short': 'L', 'lateral.right_short': 'R', - 'lateral.bilateral': 'Bilateral', - 'lateral.unpaired': 'Unilateral', 'severity.aria': 'Severity', 'severity.légère': 'mild', @@ -159,7 +154,6 @@ export const en: Dict = { 'pdf.empty': '—', 'pdf.owner_prefix': 'Owner: ', 'pdf.siret_prefix': 'SIRET ', - 'pdf.export_date_prefix': 'Exported on ', 'pdf.title.suffix.bilan': 'Faunosteo — ', 'pdf.subject': 'Animal osteopathic report', diff --git a/src/i18n/fr.ts b/src/i18n/fr.ts index 4d61744a..821d7624 100644 --- a/src/i18n/fr.ts +++ b/src/i18n/fr.ts @@ -7,14 +7,12 @@ export const fr: Dict = { 'common.confirm': 'Valider', 'common.delete': 'Supprimer', 'common.add': 'Ajouter', - 'common.back': 'Retour', 'common.home': 'Accueil', 'common.understood': 'Compris', 'common.collapse': 'Réduire', 'common.expand': 'Développer', 'common.move_up': 'Monter', 'common.move_down': 'Descendre', - 'common.none': 'Aucun', 'common.back_to_home': "Retour à l'accueil", // home @@ -41,7 +39,6 @@ export const fr: Dict = { 'footer.in_partnership': 'En partenariat avec', // editors page - 'editors.title': 'Éditeurs', 'editors.svg.title': 'Éditeur SVG', 'editors.svg.description': 'Annoter un fichier SVG anatomique : ajouter des zones cliquables, catégories et labels FR/EN.', @@ -149,8 +146,6 @@ export const fr: Dict = { 'lateral.both': 'Les deux', 'lateral.left_short': 'G', 'lateral.right_short': 'D', - 'lateral.bilateral': 'Bilatéral', - 'lateral.unpaired': 'Unilatéral', // severity 'severity.aria': 'Sévérité', @@ -175,7 +170,6 @@ export const fr: Dict = { 'pdf.empty': '—', 'pdf.owner_prefix': 'Propriétaire : ', 'pdf.siret_prefix': 'SIRET ', - 'pdf.export_date_prefix': 'Exporté le ', 'pdf.title.suffix.bilan': 'Bilan ostéo — ', 'pdf.subject': "Bilan d'ostéopathie animalière",