From 54db6eda04e1de5448822476425a3fb8f61d3d54 Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 14 Sep 2022 19:35:45 +0800 Subject: [PATCH] chore: update common locales --- web/src/components/ArchivedMemo.tsx | 1 - web/src/components/CreateShortcutDialog.tsx | 8 +++---- web/src/components/SearchBar.tsx | 4 ++-- web/src/labs/i18n/useI18n.ts | 2 +- web/src/locales/en.json | 21 +++++++++-------- web/src/locales/zh.json | 25 ++++++++++++--------- 6 files changed, 33 insertions(+), 28 deletions(-) diff --git a/web/src/components/ArchivedMemo.tsx b/web/src/components/ArchivedMemo.tsx index 87a8db37..742ebd4c 100644 --- a/web/src/components/ArchivedMemo.tsx +++ b/web/src/components/ArchivedMemo.tsx @@ -21,7 +21,6 @@ const ArchivedMemo: React.FC = (props: Props) => { }; const { t } = useI18n(); const [showConfirmDeleteBtn, toggleConfirmDeleteBtn] = useToggle(false); - const imageUrls = Array.from(memo.content.match(IMAGE_URL_REG) ?? []).map((s) => s.replace(IMAGE_URL_REG, "$1")); const handleDeleteMemoClick = async () => { if (showConfirmDeleteBtn) { diff --git a/web/src/components/CreateShortcutDialog.tsx b/web/src/components/CreateShortcutDialog.tsx index 29fb0b87..9185dcba 100644 --- a/web/src/components/CreateShortcutDialog.tsx +++ b/web/src/components/CreateShortcutDialog.tsx @@ -101,7 +101,7 @@ const CreateShortcutDialog: React.FC = (props: Props) => {

🚀 - {shortcutId ? t("common.edit-shortcut") : t("common.create-shortcut")} + {shortcutId ? t("shortcut-list.edit-shortcut") : t("shortcut-list.create-shortcut")}

- {t("common.filters")} + {t("common.filter")}
{filters.map((f, index) => { return ( @@ -127,7 +127,7 @@ const CreateShortcutDialog: React.FC = (props: Props) => { ); })}
- {t("common.new-filter")} + {t("shortcut-list.new-filter")}
@@ -136,7 +136,7 @@ const CreateShortcutDialog: React.FC = (props: Props) => {
- {shownMemoLength} {t("common.eligible-memo")} + {shownMemoLength} {t("shortcut-list.eligible-memo")}
-

{t("common.quickly-filter")}

+

{t("search.quickly-filter").toUpperCase()}

- {t("common.types")}: + {t("common.type").toUpperCase()}:
{memoSpecialTypes.map((t, idx) => { return ( diff --git a/web/src/labs/i18n/useI18n.ts b/web/src/labs/i18n/useI18n.ts index 0819590b..cfa6f0d7 100644 --- a/web/src/labs/i18n/useI18n.ts +++ b/web/src/labs/i18n/useI18n.ts @@ -21,7 +21,7 @@ const useI18n = () => { }; }, []); - const translate = (key: string) => { + const translate = (key: string): string => { const keys = key.split("."); let value = resources[locale]; for (const k of keys) { diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 30b94100..8d8af0e9 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -26,17 +26,11 @@ "sign-in": "Sign in", "sign-out": "Sign out", "back-to-home": "Back to Home", + "type": "Type", "shortcuts": "Shortcuts", - "create-shortcut" : "Create Shortcut", - "edit-shortcut": "Edit Shortcut", "title": "Title", "filter": "Filter", - "filters": "Filters", - "new-filter": "New Filter", - "eligible-memo": "eligible memo", - "tags": "Tags", - "quickly-filter": "QUICKLY FILTER", - "types": "TYPE" + "tags": "Tags" }, "slogan": "An open source, self-hosted knowledge base that works with a SQLite db file.", "auth": { @@ -77,9 +71,18 @@ "memo-list": { "fetching-data": "fetching data..." }, + "shortcut-list": { + "create-shortcut": "Create Shortcut", + "edit-shortcut": "Edit Shortcut", + "new-filter": "New Filter", + "eligible-memo": "eligible memo" + }, "tag-list": { "tip-text": "Enter `#tag ` to create" }, + "search": { + "quickly-filter": "Quickly filter" + }, "setting": { "my-account": "My Account", "preference": "Preference", @@ -95,4 +98,4 @@ "create-a-member": "Create a member" } } -} \ No newline at end of file +} diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index d1273fde..173567ea 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -26,17 +26,11 @@ "sign-in": "登录", "sign-out": "退出登录", "back-to-home": "回到主页", - "shortcuts": "快捷方式", - "create-shortcut" : "创建快捷方式", - "edit-shortcut": "编辑快捷方式", + "type": "类型", + "shortcuts": "捷径", "title": "标题", - "filter": "过滤", - "filters": "全部过滤", - "new-filter": "新建过滤", - "eligible-memo": "符合条件的memo", - "tags": "全部标签", - "quickly-filter": "快速过滤", - "types": "类型" + "filter": "过滤器", + "tags": "全部标签" }, "slogan": "一个开源的、支持私有化部署的碎片化知识卡片管理工具。", "auth": { @@ -77,9 +71,18 @@ "memo-list": { "fetching-data": "请求数据中..." }, + "shortcut-list": { + "create-shortcut": "创建捷径", + "edit-shortcut": "编辑捷径", + "new-filter": "新建过滤器", + "eligible-memo": "符合条件的 memo" + }, "tag-list": { "tip-text": "输入`#tag `来创建标签" }, + "search": { + "quickly-filter": "快速过滤" + }, "setting": { "my-account": "我的账号", "preference": "偏好设置", @@ -95,4 +98,4 @@ "create-a-member": "创建成员" } } -} \ No newline at end of file +}