From db113d226c36c7d3df68dabc8d1b53b8607e22b7 Mon Sep 17 00:00:00 2001 From: Dharanish V <30527938+dharanish-v@users.noreply.github.com> Date: Wed, 22 May 2024 10:07:50 +0530 Subject: [PATCH] feat: Add toggle group translations for multiple locales (#462) --- locales/en/translation.json | 4 ++++ locales/pt-br/translation.json | 4 ++++ locales/uk-ua/translation.json | 4 ++++ locales/zh-cn/translation.json | 4 ++++ locales/zh-tw/translation.json | 4 ++++ src/MDXEditor.tsx | 7 ++++++- src/plugins/toolbar/primitives/toolbar.tsx | 6 ++++-- 7 files changed, 30 insertions(+), 3 deletions(-) diff --git a/locales/en/translation.json b/locales/en/translation.json index 74d67e8..0f422f4 100644 --- a/locales/en/translation.json +++ b/locales/en/translation.json @@ -58,6 +58,7 @@ "selectBlockTypeTooltip": "Select block type", "placeholder": "Block type" }, + "toggleGroup":"toggle group", "removeBold": "Remove bold", "bold": "Bold", "removeItalic": "Remove italic", @@ -97,5 +98,8 @@ "codeBlock": { "language": "Code block language", "selectLanguage": "Select code block language" + }, + "contentArea":{ + "editableMarkdown": "editable markdown" } } diff --git a/locales/pt-br/translation.json b/locales/pt-br/translation.json index 7cd1fbe..5a5f4da 100644 --- a/locales/pt-br/translation.json +++ b/locales/pt-br/translation.json @@ -58,6 +58,7 @@ "selectBlockTypeTooltip": "Selecione o tipo de bloco de texto", "placeholder": "Bloco de texto" }, + "toggleGroup": "Grupo de alternância", "removeBold": "Remover negrito", "bold": "Negrito", "removeItalic": "Remover itálico", @@ -97,5 +98,8 @@ "codeBlock": { "language": "Linguagem do bloco de código", "selectLanguage": "Selecionar linguagem do bloco de código" + }, + "contentArea":{ + "editableMarkdown": "Markdown editável" } } diff --git a/locales/uk-ua/translation.json b/locales/uk-ua/translation.json index 68c28d3..6ff48b2 100644 --- a/locales/uk-ua/translation.json +++ b/locales/uk-ua/translation.json @@ -58,6 +58,7 @@ "selectBlockTypeTooltip": "Виберіть тип блоку", "placeholder": "Тип блоку" }, + "toggleGroup": "Група перемикачів", "removeBold": "Прибрати жирний шрифт", "bold": "Жирний шрифт", "removeItalic": "Видалити курсив", @@ -97,6 +98,9 @@ "codeBlock": { "language": "Мова блоку коду", "selectLanguage": "Виберіть мову блоку коду" + }, + "contentArea":{ + "editableMarkdown": "редагований маркдаун" } } diff --git a/locales/zh-cn/translation.json b/locales/zh-cn/translation.json index 392d60a..ff28d4e 100644 --- a/locales/zh-cn/translation.json +++ b/locales/zh-cn/translation.json @@ -58,6 +58,7 @@ "selectBlockTypeTooltip": "选择块类型", "placeholder": "块类型" }, + "toggleGroup": "切换组", "removeBold": "移除粗体", "bold": "粗体", "removeItalic": "移除斜体", @@ -97,5 +98,8 @@ "codeBlock": { "language": "代码块语言", "selectLanguage": "选择代码块语言" + }, + "contentArea":{ + "editableMarkdown": "可编辑的 Markdown" } } diff --git a/locales/zh-tw/translation.json b/locales/zh-tw/translation.json index 871513f..c79ba8d 100644 --- a/locales/zh-tw/translation.json +++ b/locales/zh-tw/translation.json @@ -58,6 +58,7 @@ "selectBlockTypeTooltip": "選擇塊類型", "placeholder": "塊類型" }, + "toggleGroup": "切換群組", "removeBold": "移除粗體", "bold": "粗體", "removeItalic": "移除斜體", @@ -97,5 +98,8 @@ "codeBlock": { "language": "程式碼區塊語言", "selectLanguage": "選擇程式碼區塊語言" + }, + "contentArea":{ + "editableMarkdown": "可編輯的 Markdown" } } \ No newline at end of file diff --git a/src/MDXEditor.tsx b/src/MDXEditor.tsx index 09512f9..74bc058 100644 --- a/src/MDXEditor.tsx +++ b/src/MDXEditor.tsx @@ -15,6 +15,7 @@ import { rootEditor$, setMarkdown$, topAreaChildren$, + useTranslation, viewMode$ } from './plugins/core' @@ -42,6 +43,7 @@ const LexicalProvider: React.FC<{ } const RichTextEditor: React.FC = () => { + const t = useTranslation() const [contentEditableClassName, composerChildren, topAreaChildren, editorWrappers, placeholder] = useCellValues( contentEditableClassName$, composerChildren$, @@ -58,7 +60,10 @@ const RichTextEditor: React.FC = () => {