Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: update i18n for shortcut filter (#270)
winwin20114ada7dce7725
diff --git a/web/src/components/CreateShortcutDialog.tsx b/web/src/components/CreateShortcutDialog.tsxindex c801cd149..a4051e8ba 100644--- a/web/src/components/CreateShortcutDialog.tsx+++ b/web/src/components/CreateShortcutDialog.tsx@@ -161,13 +161,17 @@ interface MemoFilterInputerProps {const MemoFilterInputer: React.FC<MemoFilterInputerProps> = (props: MemoFilterInputerProps) => {const { index, filter, handleFilterChange, handleFilterRemove } = props;+ const { t } = useTranslation();const [value, setValue] = useState<string>(filter.value.value);const tags = Array.from(memoService.getState().tags);const { type } = filter;- const dataSource =++ const operatorDataSource = Object.values(filterConsts[type as FilterType].operators).map(({ text, value }) => ({ text: t(text), value }));++ const valueDataSource =type === "TYPE"- ? filterConsts["TYPE"].values+ ? filterConsts["TYPE"].values.map(({ text, value }) => ({ text: t(text), value })): tags.sort().map((t) => {return { text: t, value: t };});@@ -242,7 +246,7 @@ const MemoFilterInputer: React.FC<MemoFilterInputerProps> = (props: MemoFilterIn/><SelectorclassName="operator-selector"- dataSource={Object.values(filterConsts[type as FilterType].operators)}+ dataSource={operatorDataSource}value={filter.value.operator}handleValueChanged={handleOperatorChange}/>@@ -256,7 +260,7 @@ const MemoFilterInputer: React.FC<MemoFilterInputerProps> = (props: MemoFilterIn}}/>) : (- <Selector className="value-selector" dataSource={dataSource} value={value} handleValueChanged={handleValueChange} />+ <Selector className="value-selector" dataSource={valueDataSource} value={value} handleValueChanged={handleValueChange} />)}<Icon.X className="remove-btn" onClick={handleRemoveBtnClick} /></div>diff --git a/web/src/components/Dialog/CommonDialog.tsx b/web/src/components/Dialog/CommonDialog.tsxindex 3975fc519..50d4bfe47 100644--- a/web/src/components/Dialog/CommonDialog.tsx+++ b/web/src/components/Dialog/CommonDialog.tsx@@ -1,3 +1,4 @@+import { useTranslation } from "react-i18next";import Icon from "../Icon";import { generateDialog } from "./BaseDialog";import "../../less/common-dialog.less";@@ -18,15 +19,18 @@ const defaultProps = {title: "",content: "",style: "info",- closeBtnText: "Close",- confirmBtnText: "Confirm",+ closeBtnText: "common.close",+ confirmBtnText: "common.confirm",onClose: () => null,onConfirm: () => null,};const CommonDialog: React.FC<Props> = (props: Props) => {+ const { t } = useTranslation();const { title, content, destroy, closeBtnText, confirmBtnText, onClose, onConfirm, style } = {...defaultProps,+ closeBtnText: t(defaultProps.closeBtnText),+ confirmBtnText: t(defaultProps.confirmBtnText),...props,};diff --git a/web/src/components/ResourcesDialog.tsx b/web/src/components/ResourcesDialog.tsxindex 331487589..135ec90c0 100644--- a/web/src/components/ResourcesDialog.tsx+++ b/web/src/components/ResourcesDialog.tsx@@ -104,13 +104,13 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {};const handleDeleteResourceBtnClick = (resource: Resource) => {- let warningText = "Are you sure to delete this resource? THIS ACTION IS IRREVERSIABLE.❗️";+ let warningText = t("resources.warning-text");if (resource.linkedMemoAmount > 0) {- warningText = warningText + `\nLinked memo amount: ${resource.linkedMemoAmount}`;+ warningText = warningText + `\n${t("resources.linked-amount")}: ${resource.linkedMemoAmount}`;}showCommonDialog({- title: `Delete Resource`,+ title: t("resources.delete-resource"),content: warningText,style: "warning",onConfirm: async () => {diff --git a/web/src/helpers/filter.ts b/web/src/helpers/filter.tsindex 7865d9383..039c1e6f8 100644--- a/web/src/helpers/filter.ts+++ b/web/src/helpers/filter.ts@@ -11,11 +11,11 @@ export const filterConsts = {value: "TAG",operators: [{- text: "Contains",+ text: "shortcut-list.operator.contains",value: "CONTAIN",},{- text: "Does not contain",+ text: "shortcut-list.operator.not-contains",value: "NOT_CONTAIN",},],@@ -25,21 +25,21 @@ export const filterConsts = {value: "TYPE",operators: [{- text: "Is",+ text: "shortcut-list.operator.is",value: "IS",},{- text: "Is not",+ text: "shortcut-list.operator.is-not",value: "IS_NOT",},],values: [{- text: "No tags",+ text: "shortcut-list.value.not-tagged",value: "NOT_TAGGED",},{- text: "Has links",+ text: "shortcut-list.value.linked",value: "LINKED",},],@@ -49,11 +49,11 @@ export const filterConsts = {value: "TEXT",operators: [{- text: "Contain",+ text: "shortcut-list.operator.contains",value: "CONTAIN",},{- text: "Does not contain",+ text: "shortcut-list.operator.not-contains",value: "NOT_CONTAIN",},],diff --git a/web/src/locales/en.json b/web/src/locales/en.jsonindex ce4160226..c99b3f7db 100644--- a/web/src/locales/en.json+++ b/web/src/locales/en.json@@ -7,9 +7,11 @@"repeat-new-password": "Repeat the new password","username": "Username","save": "Save",+ "close": "Close","cancel": "Cancel","create": "Create","change": "Change",+ "confirm": "Confirm","reset": "Reset","language": "Language","version": "Version",@@ -58,7 +60,10 @@"fetching-data": "fetching data...","upload": "Upload","preview": "Preview",- "copy-link": "Copy Link"+ "copy-link": "Copy Link",+ "delete-resource": "Delete Resource",+ "warning-text": "Are you sure to delete this resource? THIS ACTION IS IRREVERSIABLE❗️",+ "linked-amount": "Linked memo amount"},"archived": {"archived-memos": "Archived Memos",@@ -91,7 +96,17 @@"new-filter": "New Filter","eligible-memo": "eligible memo","fill-previous": "Please fill in previous filter value",- "title-required": "Title is required"+ "title-required": "Title is required",+ "operator": {+ "contains": "Contains",+ "not-contains": "Does not contain",+ "is": "Is",+ "is-not": "Is Not"+ },+ "value": {+ "not-tagged": "No tags",+ "linked": "Has links"+ }},"tag-list": {"tip-text": "Enter `#tag ` to create"@@ -142,4 +157,4 @@"copied": "Copied","succeed-copy-content": "Succeed to copy content to clipboard."}-}+}\ No newline at end of filediff --git a/web/src/locales/zh.json b/web/src/locales/zh.jsonindex f9bb38db5..a9c1386f9 100644--- a/web/src/locales/zh.json+++ b/web/src/locales/zh.json@@ -7,9 +7,11 @@"repeat-new-password": "重复新密码","username": "用户名","save": "保存",+ "close": "关闭","cancel": "退出","create": "创建","change": "修改",+ "confirm": "确定","reset": "重置","language": "语言","version": "版本",@@ -58,7 +60,10 @@"fetching-data": "请求数据中...","upload": "上传","preview": "预览",- "copy-link": "拷贝链接"+ "copy-link": "拷贝链接",+ "delete-resource": "删除资源",+ "warning-text": "确定删除这个资源么?此操作不可逆❗️",+ "linked-amount": "链接的 Memo 数量"},"archived": {"archived-memos": "已归档的 Memo",@@ -91,7 +96,17 @@"new-filter": "新建过滤器","eligible-memo": "符合条件的 memo","fill-previous": "请填写之前的过滤值",- "title-required": "标题是必填项。"+ "title-required": "标题是必填项。",+ "operator": {+ "contains": "包含",+ "not-contains": "不包含",+ "is": "是",+ "is-not": "不是"+ },+ "value": {+ "not-tagged": "无标签",+ "linked": "包含链接"+ }},"tag-list": {"tip-text": "输入`#tag `来创建标签"@@ -142,4 +157,4 @@"copied": "Copied","succeed-copy-content": "Succeed to copy content to clipboard."}-}+}\ No newline at end of file