From 34ae9421e219cd67c546167df27007e72dcfef0a Mon Sep 17 00:00:00 2001 From: DIYgod Date: Fri, 3 Mar 2023 22:39:19 +0000 Subject: [PATCH] feat: add missing translation --- public/locales/zh/dashboard.json | 5 ++++- src/components/ui/Editor.tsx | 6 ++++-- src/pages/dashboard/[subdomain]/editor.tsx | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/public/locales/zh/dashboard.json b/public/locales/zh/dashboard.json index 7e6596ef..62891b13 100644 --- a/public/locales/zh/dashboard.json +++ b/public/locales/zh/dashboard.json @@ -5,6 +5,7 @@ "Notifications": "通知", "Unread notifications": "未读通知", "Settings": "设置", + "Events": "活动", "Site Stats": "站点统计", "Total Posts": "文章总数", "Total Comments": "评论总数", @@ -128,5 +129,7 @@ "View the transaction": "查看交易", "Share to Twitter": "分享到 Twitter", "Got it, thanks!" : "好的,谢谢!", - "Published!" : "已发布!" + "Published!" : "已发布!", + "Title goes here...": "标题在这里...", + "Start writing...": "开始写作..." } \ No newline at end of file diff --git a/src/components/ui/Editor.tsx b/src/components/ui/Editor.tsx index a4197fce..f617b0f0 100644 --- a/src/components/ui/Editor.tsx +++ b/src/components/ui/Editor.tsx @@ -3,7 +3,8 @@ import { EditorView, ViewUpdate } from "@codemirror/view" import { markdown } from "@codemirror/lang-markdown" import { scroll } from "@uiw/codemirror-extensions-events" import type { EditorState } from "@codemirror/state" -import { useCallback, useState, useEffect, useMemo } from "react" +import { useState, useEffect, useMemo } from "react" +import { useTranslation } from "next-i18next" export const Editor: React.FC<{ value: string @@ -22,6 +23,7 @@ export const Editor: React.FC<{ onCreateEditor, onMouseEnter, }) => { + const { t } = useTranslation("dashboard") const [extensions, setExtensions] = useState([]) useEffect(() => { setExtensions([ @@ -103,7 +105,7 @@ export const Editor: React.FC<{ }} indentWithTab={true} onChange={onChange} - placeholder="Start writing..." + placeholder={t("Start writing...") || ""} onUpdate={onUpdate} onMouseEnter={onMouseEnter} /> diff --git a/src/pages/dashboard/[subdomain]/editor.tsx b/src/pages/dashboard/[subdomain]/editor.tsx index cde4b13f..b57bb719 100644 --- a/src/pages/dashboard/[subdomain]/editor.tsx +++ b/src/pages/dashboard/[subdomain]/editor.tsx @@ -463,7 +463,7 @@ export default function SubdomainEditor() { }} onChange={(e) => updateValue("title", e.target.value)} className="h-12 ml-1 inline-flex items-center border-none text-3xl font-bold w-full focus:outline-none" - placeholder="Title goes here.." + placeholder={t("Title goes here...") || ""} />