From 5bdf15aecec545ebfa1205d7504dad6e1eb9e798 Mon Sep 17 00:00:00 2001 From: winwin2011 Date: Wed, 2 Nov 2022 06:44:23 +0800 Subject: [PATCH] chore: fold/expand i18n (#400) --- web/src/components/MemoContent.tsx | 4 +++- web/src/locales/en.json | 6 ++++-- web/src/locales/vi.json | 6 ++++-- web/src/locales/zh.json | 6 ++++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/web/src/components/MemoContent.tsx b/web/src/components/MemoContent.tsx index 11a963c..f45e555 100644 --- a/web/src/components/MemoContent.tsx +++ b/web/src/components/MemoContent.tsx @@ -1,4 +1,5 @@ import { useEffect, useRef, useState } from "react"; +import { useTranslation } from "react-i18next"; import { marked } from "../labs/marked"; import Icon from "./Icon"; import "../less/memo-content.less"; @@ -29,6 +30,7 @@ const MAX_MEMO_CONTAINER_HEIGHT = 384; const MemoContent: React.FC = (props: Props) => { const { className, content, onMemoContentClick, onMemoContentDoubleClick } = props; + const { t } = useTranslation(); const [state, setState] = useState({ expandButtonStatus: -1, }); @@ -84,7 +86,7 @@ const MemoContent: React.FC = (props: Props) => { {state.expandButtonStatus !== -1 && (
- {state.expandButtonStatus === 0 ? "Expand" : "Fold"} + {state.expandButtonStatus === 0 ? t("common.expand") : t("common.fold")}
diff --git a/web/src/locales/en.json b/web/src/locales/en.json index db87e0f..87f98d8 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -38,7 +38,9 @@ "yourself": "Yourself", "archived-at": "Archived at", "changed": "changed", - "update-on": "Update on" + "update-on": "Update on", + "fold": "Fold", + "expand": "Expand" }, "slogan": "An open source, self-hosted knowledge base that works with a SQLite db file.", "auth": { @@ -171,4 +173,4 @@ "resource-filename-updated": "Resource filename changed.", "invalid-resource-filename": "Invalid filename." } -} +} \ No newline at end of file diff --git a/web/src/locales/vi.json b/web/src/locales/vi.json index 1d3336a..51d59b1 100644 --- a/web/src/locales/vi.json +++ b/web/src/locales/vi.json @@ -38,7 +38,9 @@ "yourself": "Chính bạn", "archived-at": "Lưu trữ lúc", "changed": "đã thay đổi", - "update-on": "Cập nhật" + "update-on": "Cập nhật", + "fold": "Fold", + "expand": "Expand" }, "slogan": "Một mã nguồn mở, tự bạn lưu lại mọi thứ bạn biết dựa trên SQLite db.", "auth": { @@ -171,4 +173,4 @@ "resource-filename-updated": "Tên tệp tài nguyên đã thay đổi.", "invalid-resource-filename": "Tên tệp không hợp lệ." } -} +} \ No newline at end of file diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index 883411a..3073eba 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -38,7 +38,9 @@ "yourself": "你自己", "archived-at": "归档于", "changed": "已更改", - "update-on": "更新于" + "update-on": "更新于", + "fold": "折叠", + "expand": "展开" }, "slogan": "一个开源的、支持私有化部署的碎片化知识卡片管理工具。", "auth": { @@ -171,4 +173,4 @@ "resource-filename-updated": "资源文件名更改成功。", "invalid-resource-filename": "无效的资源文件名" } -} +} \ No newline at end of file