diff --git a/.changeset/warm-trees-act.md b/.changeset/warm-trees-act.md new file mode 100644 index 0000000..8d66dc9 --- /dev/null +++ b/.changeset/warm-trees-act.md @@ -0,0 +1,5 @@ +--- +"@openfun/cunningham-react": patch +--- + +Fix translations method and added missing translations diff --git a/packages/react/src/components/Provider/index.tsx b/packages/react/src/components/Provider/index.tsx index 72dd1af..aae9271 100644 --- a/packages/react/src/components/Provider/index.tsx +++ b/packages/react/src/components/Provider/index.tsx @@ -47,7 +47,10 @@ const findTranslation = ( locale: TranslationSet, ): string | undefined => { const [namespace, ...keys] = key.split("."); - return keys.reduce((acc, subKey) => acc[subKey], (locale as any)[namespace]); + return keys.reduce( + (acc, subKey) => acc?.[subKey], + (locale as any)[namespace], + ); }; export const CunninghamProvider = ({ diff --git a/packages/react/src/locales/fr-FR.json b/packages/react/src/locales/fr-FR.json index 5c4f0b4..9ed6415 100644 --- a/packages/react/src/locales/fr-FR.json +++ b/packages/react/src/locales/fr-FR.json @@ -46,6 +46,27 @@ "year_select_button_aria_label": "Sélectionner une année", "month_select_button_aria_label": "Sélectionner un mois" } + }, + "modals": { + "helpers": { + "delete_confirmation": { + "title": "Êtes-vous sûr ?", + "children": "Êtes-vous sûr de vouloir supprimer cet élément ?", + "cancel": "Annuler", + "delete": "Supprimer" + }, + "confirmation": { + "title": "Êtes-vous sûr ?", + "children": "Êtes-vous sûr de vouloir faire cela ?", + "cancel": "Annuler", + "yes": "Oui" + }, + "disclaimer": { + "title": "Avertissement", + "children": "Ceci est un avertissement", + "ok": "Ok" + } + } } } }