From 55785e9d145db0ab029c39609b3ea5489aeca109 Mon Sep 17 00:00:00 2001 From: Arnaud Robin Date: Mon, 16 Sep 2024 22:00:16 +0200 Subject: [PATCH] :globe_with_meridians: (frontend) add language localization --- .../docs/doc-editor/components/AIButton.tsx | 22 +++++++++++-------- .../apps/impress/src/i18n/translations.json | 11 +++++++++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/AIButton.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/AIButton.tsx index ba22978b..7ae43d64 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/AIButton.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/AIButton.tsx @@ -17,6 +17,8 @@ import {Box, Text } from '@/components'; import { Doc } from '../../doc-management'; import { AIActions, useAIRewrite } from '../api/useAIRewrite'; +import { useTranslation } from 'react-i18next'; + interface AIGroupButtonProps { doc: Doc; } @@ -25,6 +27,7 @@ export function AIGroupButton({ doc }: AIGroupButtonProps) { const editor = useBlockNoteEditor(); const Components = useComponentsContext(); const selectedBlocks = useSelectedBlocks(editor); + const { t } = useTranslation(); const show = useMemo(() => { return !!selectedBlocks.find((block) => block.content !== undefined); @@ -41,23 +44,23 @@ export function AIGroupButton({ doc }: AIGroupButtonProps) { className="bn-button" data-test="ai-actions" label="AI" - mainTooltip="AI Actions" + mainTooltip={t('AI Actions')} > AI text_fields}> - Use as prompt + {t('Use as prompt')} refresh}> - Rephrase + {t('Rephrase')} summarize}> - Summarize + {t('Summarize')} check}> - Correct + {t('Correct')} @@ -113,23 +116,24 @@ interface TranslateMenuProps { const TranslateMenu = ({ docId }: TranslateMenuProps) => { const Components = useComponentsContext()!; + const { t } = useTranslation(); return ( translate} close> - Translate + {t('Translate')} - English + {t('English')} - French + {t('French')} - German + {t('German')} diff --git a/src/frontend/apps/impress/src/i18n/translations.json b/src/frontend/apps/impress/src/i18n/translations.json index f656ac1c..141e385e 100644 --- a/src/frontend/apps/impress/src/i18n/translations.json +++ b/src/frontend/apps/impress/src/i18n/translations.json @@ -140,7 +140,16 @@ "accessibility-dinum-services": "DINUM s'engage à rendre accessibles ses services numériques, conformément à l'article 47 de la loi n° 2005-102 du 11 février 2005.", "accessibility-form-defenseurdesdroits": "Écrire un message au<1>Défenseur des droits", "accessibility-not-audit": "docs.numerique.gouv.fr n'est pas en conformité avec le RGAA 4.1. Le site n'a pas encore été audité.", - "you have reported to the website manager a lack of accessibility that prevents you from accessing content or one of the services of the portal and you have not received a satisfactory response.": "vous avez signalé au responsable du site internet un défaut d'accessibilité qui vous empêche d'accéder à un contenu ou à un des services du portail et vous n'avez pas obtenu de réponse satisfaisante." + "you have reported to the website manager a lack of accessibility that prevents you from accessing content or one of the services of the portal and you have not received a satisfactory response.": "vous avez signalé au responsable du site internet un défaut d'accessibilité qui vous empêche d'accéder à un contenu ou à un des services du portail et vous n'avez pas obtenu de réponse satisfaisante.", + "AI Actions": "Actions IA", + "Use as prompt": "Utiliser comme prompt", + "Rephrase": "Reformuler", + "Summarize": "Résumer", + "Correct": "Corriger", + "Translate": "Traduire", + "English": "Anglais", + "French": "Français", + "German": "Allemand" } } }