mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: update i18n for shortcut filter (#270)
* chore: resources i18n * chore: shortcut-list i18n * chore: resources i18n * chore: resources i18n * chore: resources i18n
This commit is contained in:
@ -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
|
||||
/>
|
||||
<Selector
|
||||
className="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>
|
||||
|
@ -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,
|
||||
};
|
||||
|
||||
|
@ -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 () => {
|
||||
|
@ -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",
|
||||
},
|
||||
],
|
||||
|
@ -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"
|
||||
|
@ -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 `来创建标签"
|
||||
|
Reference in New Issue
Block a user