fix(ui): localize Dialog close and LanguageSwitcher group aria-labels
B-1: Dialog close button exposed French 'Fermer' to EN screen-reader users; B-2: switcher group label was English-only. New dict keys common.close + lang.group_label in both dicts (parity kept).
This commit is contained in:
1 parent
b7e6371f8a
commit
83f02c8fa8
4 files changed
+8
-2
No files matched your search
@@ -14,7 +14,7 @@ export default function LanguageSwitcher() {
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
role="group"
|
role="group"
|
||||||
aria-label="Language"
|
aria-label={t('lang.group_label')}
|
||||||
className="inline-flex rounded-full border border-[var(--color-border)] overflow-hidden text-xs font-medium"
|
className="inline-flex rounded-full border border-[var(--color-border)] overflow-hidden text-xs font-medium"
|
||||||
>
|
>
|
||||||
{ITEMS.map((item) => {
|
{ITEMS.map((item) => {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useEffect, type ReactNode } from 'react'
|
import { useEffect, type ReactNode } from 'react'
|
||||||
import { AnimatePresence, motion } from 'motion/react'
|
import { AnimatePresence, motion } from 'motion/react'
|
||||||
|
import { useT } from '@/i18n/useT'
|
||||||
|
|
||||||
export interface DialogProps {
|
export interface DialogProps {
|
||||||
open: boolean
|
open: boolean
|
||||||
@@ -17,6 +18,7 @@ const SIZE: Record<NonNullable<DialogProps['size']>, string> = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function Dialog({ open, onClose, title, children, size = 'md' }: DialogProps) {
|
export default function Dialog({ open, onClose, title, children, size = 'md' }: DialogProps) {
|
||||||
|
const t = useT()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!open) return
|
if (!open) return
|
||||||
const onKey = (e: KeyboardEvent) => e.key === 'Escape' && onClose()
|
const onKey = (e: KeyboardEvent) => e.key === 'Escape' && onClose()
|
||||||
@@ -51,7 +53,7 @@ export default function Dialog({ open, onClose, title, children, size = 'md' }:
|
|||||||
<h2 className="text-lg font-semibold text-[var(--color-ink)]">{title}</h2>
|
<h2 className="text-lg font-semibold text-[var(--color-ink)]">{title}</h2>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
aria-label="Fermer"
|
aria-label={t('common.close')}
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
className="rounded-md p-1 text-[var(--color-ink-muted)] hover:bg-[var(--color-surface-strong)]"
|
className="rounded-md p-1 text-[var(--color-ink-muted)] hover:bg-[var(--color-surface-strong)]"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import type { Dict } from './types'
|
|||||||
|
|
||||||
export const en: Dict = {
|
export const en: Dict = {
|
||||||
'common.cancel': 'Cancel',
|
'common.cancel': 'Cancel',
|
||||||
|
'common.close': 'Close',
|
||||||
'common.save': 'Save',
|
'common.save': 'Save',
|
||||||
'common.confirm': 'Confirm',
|
'common.confirm': 'Confirm',
|
||||||
'common.delete': 'Delete',
|
'common.delete': 'Delete',
|
||||||
@@ -157,6 +158,7 @@ export const en: Dict = {
|
|||||||
'pdf.title.suffix.bilan': 'Faunosteo — ',
|
'pdf.title.suffix.bilan': 'Faunosteo — ',
|
||||||
'pdf.subject': 'Animal osteopathic report',
|
'pdf.subject': 'Animal osteopathic report',
|
||||||
|
|
||||||
|
'lang.group_label': 'Language',
|
||||||
'lang.switch_to_fr': 'Passer en français',
|
'lang.switch_to_fr': 'Passer en français',
|
||||||
'lang.switch_to_en': 'Switch to English',
|
'lang.switch_to_en': 'Switch to English',
|
||||||
'lang.fr': 'FR',
|
'lang.fr': 'FR',
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import type { Dict } from './types'
|
|||||||
export const fr: Dict = {
|
export const fr: Dict = {
|
||||||
// common
|
// common
|
||||||
'common.cancel': 'Annuler',
|
'common.cancel': 'Annuler',
|
||||||
|
'common.close': 'Fermer',
|
||||||
'common.save': 'Enregistrer',
|
'common.save': 'Enregistrer',
|
||||||
'common.confirm': 'Valider',
|
'common.confirm': 'Valider',
|
||||||
'common.delete': 'Supprimer',
|
'common.delete': 'Supprimer',
|
||||||
@@ -174,6 +175,7 @@ export const fr: Dict = {
|
|||||||
'pdf.subject': "Bilan d'ostéopathie animalière",
|
'pdf.subject': "Bilan d'ostéopathie animalière",
|
||||||
|
|
||||||
// language switcher
|
// language switcher
|
||||||
|
'lang.group_label': 'Langue',
|
||||||
'lang.switch_to_fr': 'Passer en français',
|
'lang.switch_to_fr': 'Passer en français',
|
||||||
'lang.switch_to_en': 'Switch to English',
|
'lang.switch_to_en': 'Switch to English',
|
||||||
'lang.fr': 'FR',
|
'lang.fr': 'FR',
|
||||||
|
|||||||
Reference in new issue
Block a user