chore(i18n): drop dead dict keys, wire LanguageSwitcher through dict

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).
This commit is contained in:
Bastien Chanot committed 2026-07-12 04:48:04 +02:00
1 parent bbdc0e851a
commit 4ea8c90c7f
3 files changed
+7 -17

No files matched your search

+7 -5
View File
@@ -1,14 +1,16 @@
import { useLocaleStore } from '@/state/localeStore' import { useLocaleStore } from '@/state/localeStore'
import { useT } from '@/i18n/useT'
import type { Locale } from '@/i18n/types' import type { Locale } from '@/i18n/types'
const ITEMS: { value: Locale; label: string; ariaLabel: string }[] = [ const ITEMS: { value: Locale; labelKey: string; ariaKey: string }[] = [
{ value: 'fr', label: 'FR', ariaLabel: 'Passer en français' }, { value: 'fr', labelKey: 'lang.fr', ariaKey: 'lang.switch_to_fr' },
{ value: 'en', label: 'EN', ariaLabel: 'Switch to English' }, { value: 'en', labelKey: 'lang.en', ariaKey: 'lang.switch_to_en' },
] ]
export default function LanguageSwitcher() { export default function LanguageSwitcher() {
const locale = useLocaleStore((s) => s.locale) const locale = useLocaleStore((s) => s.locale)
const setLocale = useLocaleStore((s) => s.setLocale) const setLocale = useLocaleStore((s) => s.setLocale)
const t = useT()
return ( return (
<div <div
role="group" role="group"
@@ -21,7 +23,7 @@ export default function LanguageSwitcher() {
<button <button
key={item.value} key={item.value}
type="button" type="button"
aria-label={item.ariaLabel} aria-label={t(item.ariaKey)}
aria-pressed={active} aria-pressed={active}
onClick={() => setLocale(item.value)} onClick={() => setLocale(item.value)}
className={[ className={[
@@ -31,7 +33,7 @@ export default function LanguageSwitcher() {
: 'text-[var(--color-ink)] hover:bg-[var(--color-surface-strong)]', : 'text-[var(--color-ink)] hover:bg-[var(--color-surface-strong)]',
].join(' ')} ].join(' ')}
> >
{item.label} {t(item.labelKey)}
</button> </button>
) )
})} })}
-6
View File
@@ -6,14 +6,12 @@ export const en: Dict = {
'common.confirm': 'Confirm', 'common.confirm': 'Confirm',
'common.delete': 'Delete', 'common.delete': 'Delete',
'common.add': 'Add', 'common.add': 'Add',
'common.back': 'Back',
'common.home': 'Home', 'common.home': 'Home',
'common.understood': 'Got it', 'common.understood': 'Got it',
'common.collapse': 'Collapse', 'common.collapse': 'Collapse',
'common.expand': 'Expand', 'common.expand': 'Expand',
'common.move_up': 'Move up', 'common.move_up': 'Move up',
'common.move_down': 'Move down', 'common.move_down': 'Move down',
'common.none': 'None',
'common.back_to_home': 'Back to home', 'common.back_to_home': 'Back to home',
'home.new_report.title': 'New report', 'home.new_report.title': 'New report',
@@ -37,7 +35,6 @@ export const en: Dict = {
'footer.in_partnership': 'In partnership with', 'footer.in_partnership': 'In partnership with',
// editors page // editors page
'editors.title': 'Editors',
'editors.svg.title': 'SVG Editor', 'editors.svg.title': 'SVG Editor',
'editors.svg.description': 'editors.svg.description':
'Annotate an anatomical SVG file: add clickable zones, categories, and FR/EN labels.', '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.both': 'Both',
'lateral.left_short': 'L', 'lateral.left_short': 'L',
'lateral.right_short': 'R', 'lateral.right_short': 'R',
'lateral.bilateral': 'Bilateral',
'lateral.unpaired': 'Unilateral',
'severity.aria': 'Severity', 'severity.aria': 'Severity',
'severity.légère': 'mild', 'severity.légère': 'mild',
@@ -159,7 +154,6 @@ export const en: Dict = {
'pdf.empty': '—', 'pdf.empty': '—',
'pdf.owner_prefix': 'Owner: ', 'pdf.owner_prefix': 'Owner: ',
'pdf.siret_prefix': 'SIRET ', 'pdf.siret_prefix': 'SIRET ',
'pdf.export_date_prefix': 'Exported on ',
'pdf.title.suffix.bilan': 'Faunosteo — ', 'pdf.title.suffix.bilan': 'Faunosteo — ',
'pdf.subject': 'Animal osteopathic report', 'pdf.subject': 'Animal osteopathic report',
-6
View File
@@ -7,14 +7,12 @@ export const fr: Dict = {
'common.confirm': 'Valider', 'common.confirm': 'Valider',
'common.delete': 'Supprimer', 'common.delete': 'Supprimer',
'common.add': 'Ajouter', 'common.add': 'Ajouter',
'common.back': 'Retour',
'common.home': 'Accueil', 'common.home': 'Accueil',
'common.understood': 'Compris', 'common.understood': 'Compris',
'common.collapse': 'Réduire', 'common.collapse': 'Réduire',
'common.expand': 'Développer', 'common.expand': 'Développer',
'common.move_up': 'Monter', 'common.move_up': 'Monter',
'common.move_down': 'Descendre', 'common.move_down': 'Descendre',
'common.none': 'Aucun',
'common.back_to_home': "Retour à l'accueil", 'common.back_to_home': "Retour à l'accueil",
// home // home
@@ -41,7 +39,6 @@ export const fr: Dict = {
'footer.in_partnership': 'En partenariat avec', 'footer.in_partnership': 'En partenariat avec',
// editors page // editors page
'editors.title': 'Éditeurs',
'editors.svg.title': 'Éditeur SVG', 'editors.svg.title': 'Éditeur SVG',
'editors.svg.description': 'editors.svg.description':
'Annoter un fichier SVG anatomique : ajouter des zones cliquables, catégories et labels FR/EN.', '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.both': 'Les deux',
'lateral.left_short': 'G', 'lateral.left_short': 'G',
'lateral.right_short': 'D', 'lateral.right_short': 'D',
'lateral.bilateral': 'Bilatéral',
'lateral.unpaired': 'Unilatéral',
// severity // severity
'severity.aria': 'Sévérité', 'severity.aria': 'Sévérité',
@@ -175,7 +170,6 @@ export const fr: Dict = {
'pdf.empty': '—', 'pdf.empty': '—',
'pdf.owner_prefix': 'Propriétaire : ', 'pdf.owner_prefix': 'Propriétaire : ',
'pdf.siret_prefix': 'SIRET ', 'pdf.siret_prefix': 'SIRET ',
'pdf.export_date_prefix': 'Exporté le ',
'pdf.title.suffix.bilan': 'Bilan ostéo — ', 'pdf.title.suffix.bilan': 'Bilan ostéo — ',
'pdf.subject': "Bilan d'ostéopathie animalière", 'pdf.subject': "Bilan d'ostéopathie animalière",