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:
1 parent
bbdc0e851a
commit
4ea8c90c7f
3 files changed
+7
-17
No files matched your search
@@ -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 (
|
||||
<div
|
||||
role="group"
|
||||
@@ -21,7 +23,7 @@ export default function LanguageSwitcher() {
|
||||
<button
|
||||
key={item.value}
|
||||
type="button"
|
||||
aria-label={item.ariaLabel}
|
||||
aria-label={t(item.ariaKey)}
|
||||
aria-pressed={active}
|
||||
onClick={() => 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)}
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
|
||||
Reference in new issue
Block a user