mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
feat: update i18n for zh-hans (#4488)
* chore:memo filter support i18n for zh-hans * feat: restore addFilter method value field in StatisticsView.tsx * chore: change getFilterDisplayText for i18n * chore: add string type in utils/i18n * feat: using switch to avoid change TranslationType * feat: eslint check * feat: eslint fix
This commit is contained in:
@@ -3,8 +3,10 @@ import { CalendarIcon, CheckCircleIcon, CodeIcon, EyeIcon, HashIcon, LinkIcon, S
|
||||
import { useEffect } from "react";
|
||||
import { useSearchParams } from "react-router-dom";
|
||||
import { FilterFactor, getMemoFilterKey, MemoFilter, stringifyFilters, useMemoFilterStore } from "@/store/v1";
|
||||
import { useTranslate } from "@/utils/i18n";
|
||||
|
||||
const MemoFilters = () => {
|
||||
const t = useTranslate();
|
||||
const [, setSearchParams] = useSearchParams();
|
||||
const memoFilterStore = useMemoFilterStore();
|
||||
const filters = memoFilterStore.filters;
|
||||
@@ -22,7 +24,17 @@ const MemoFilters = () => {
|
||||
return filter.value;
|
||||
}
|
||||
if (filter.factor.startsWith("property.")) {
|
||||
return filter.factor.replace("property.", "");
|
||||
const factorLabel = filter.factor.replace("property.", "");
|
||||
switch (factorLabel) {
|
||||
case "hasLink":
|
||||
return t("filters.has-link");
|
||||
case "hasCode":
|
||||
return t("filters.has-code");
|
||||
case "hasTaskList":
|
||||
return t("filters.has-task-list");
|
||||
default:
|
||||
return factorLabel;
|
||||
}
|
||||
}
|
||||
return filter.factor;
|
||||
};
|
||||
|
@@ -408,5 +408,10 @@
|
||||
"official-website": "Official Website",
|
||||
"blogs": "Blogs",
|
||||
"documents": "Documents"
|
||||
},
|
||||
"filters": {
|
||||
"has-link": "hasLink",
|
||||
"has-task-list": "hasTaskList",
|
||||
"has-code": "hasCode"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -392,5 +392,10 @@
|
||||
"official-website": "官网",
|
||||
"blogs": "博客",
|
||||
"documents": "文档"
|
||||
},
|
||||
"filters": {
|
||||
"has-link": "有链接",
|
||||
"has-task-list": "有待办",
|
||||
"has-code": "有代码"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user