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 MemoFilterInputer: React.FC<MemoFilterInputerProps> = (props: MemoFilterInputerProps) => {
|
||||||
const { index, filter, handleFilterChange, handleFilterRemove } = props;
|
const { index, filter, handleFilterChange, handleFilterRemove } = props;
|
||||||
|
const { t } = useTranslation();
|
||||||
const [value, setValue] = useState<string>(filter.value.value);
|
const [value, setValue] = useState<string>(filter.value.value);
|
||||||
|
|
||||||
const tags = Array.from(memoService.getState().tags);
|
const tags = Array.from(memoService.getState().tags);
|
||||||
const { type } = filter;
|
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"
|
type === "TYPE"
|
||||||
? filterConsts["TYPE"].values
|
? filterConsts["TYPE"].values.map(({ text, value }) => ({ text: t(text), value }))
|
||||||
: tags.sort().map((t) => {
|
: tags.sort().map((t) => {
|
||||||
return { text: t, value: t };
|
return { text: t, value: t };
|
||||||
});
|
});
|
||||||
@ -242,7 +246,7 @@ const MemoFilterInputer: React.FC<MemoFilterInputerProps> = (props: MemoFilterIn
|
|||||||
/>
|
/>
|
||||||
<Selector
|
<Selector
|
||||||
className="operator-selector"
|
className="operator-selector"
|
||||||
dataSource={Object.values(filterConsts[type as FilterType].operators)}
|
dataSource={operatorDataSource}
|
||||||
value={filter.value.operator}
|
value={filter.value.operator}
|
||||||
handleValueChanged={handleOperatorChange}
|
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} />
|
<Icon.X className="remove-btn" onClick={handleRemoveBtnClick} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import Icon from "../Icon";
|
import Icon from "../Icon";
|
||||||
import { generateDialog } from "./BaseDialog";
|
import { generateDialog } from "./BaseDialog";
|
||||||
import "../../less/common-dialog.less";
|
import "../../less/common-dialog.less";
|
||||||
@ -18,15 +19,18 @@ const defaultProps = {
|
|||||||
title: "",
|
title: "",
|
||||||
content: "",
|
content: "",
|
||||||
style: "info",
|
style: "info",
|
||||||
closeBtnText: "Close",
|
closeBtnText: "common.close",
|
||||||
confirmBtnText: "Confirm",
|
confirmBtnText: "common.confirm",
|
||||||
onClose: () => null,
|
onClose: () => null,
|
||||||
onConfirm: () => null,
|
onConfirm: () => null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const CommonDialog: React.FC<Props> = (props: Props) => {
|
const CommonDialog: React.FC<Props> = (props: Props) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
const { title, content, destroy, closeBtnText, confirmBtnText, onClose, onConfirm, style } = {
|
const { title, content, destroy, closeBtnText, confirmBtnText, onClose, onConfirm, style } = {
|
||||||
...defaultProps,
|
...defaultProps,
|
||||||
|
closeBtnText: t(defaultProps.closeBtnText),
|
||||||
|
confirmBtnText: t(defaultProps.confirmBtnText),
|
||||||
...props,
|
...props,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -104,13 +104,13 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDeleteResourceBtnClick = (resource: Resource) => {
|
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) {
|
if (resource.linkedMemoAmount > 0) {
|
||||||
warningText = warningText + `\nLinked memo amount: ${resource.linkedMemoAmount}`;
|
warningText = warningText + `\n${t("resources.linked-amount")}: ${resource.linkedMemoAmount}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
showCommonDialog({
|
showCommonDialog({
|
||||||
title: `Delete Resource`,
|
title: t("resources.delete-resource"),
|
||||||
content: warningText,
|
content: warningText,
|
||||||
style: "warning",
|
style: "warning",
|
||||||
onConfirm: async () => {
|
onConfirm: async () => {
|
||||||
|
@ -11,11 +11,11 @@ export const filterConsts = {
|
|||||||
value: "TAG",
|
value: "TAG",
|
||||||
operators: [
|
operators: [
|
||||||
{
|
{
|
||||||
text: "Contains",
|
text: "shortcut-list.operator.contains",
|
||||||
value: "CONTAIN",
|
value: "CONTAIN",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: "Does not contain",
|
text: "shortcut-list.operator.not-contains",
|
||||||
value: "NOT_CONTAIN",
|
value: "NOT_CONTAIN",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -25,21 +25,21 @@ export const filterConsts = {
|
|||||||
value: "TYPE",
|
value: "TYPE",
|
||||||
operators: [
|
operators: [
|
||||||
{
|
{
|
||||||
text: "Is",
|
text: "shortcut-list.operator.is",
|
||||||
value: "IS",
|
value: "IS",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: "Is not",
|
text: "shortcut-list.operator.is-not",
|
||||||
value: "IS_NOT",
|
value: "IS_NOT",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
values: [
|
values: [
|
||||||
{
|
{
|
||||||
text: "No tags",
|
text: "shortcut-list.value.not-tagged",
|
||||||
value: "NOT_TAGGED",
|
value: "NOT_TAGGED",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: "Has links",
|
text: "shortcut-list.value.linked",
|
||||||
value: "LINKED",
|
value: "LINKED",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -49,11 +49,11 @@ export const filterConsts = {
|
|||||||
value: "TEXT",
|
value: "TEXT",
|
||||||
operators: [
|
operators: [
|
||||||
{
|
{
|
||||||
text: "Contain",
|
text: "shortcut-list.operator.contains",
|
||||||
value: "CONTAIN",
|
value: "CONTAIN",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: "Does not contain",
|
text: "shortcut-list.operator.not-contains",
|
||||||
value: "NOT_CONTAIN",
|
value: "NOT_CONTAIN",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -7,9 +7,11 @@
|
|||||||
"repeat-new-password": "Repeat the new password",
|
"repeat-new-password": "Repeat the new password",
|
||||||
"username": "Username",
|
"username": "Username",
|
||||||
"save": "Save",
|
"save": "Save",
|
||||||
|
"close": "Close",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"create": "Create",
|
"create": "Create",
|
||||||
"change": "Change",
|
"change": "Change",
|
||||||
|
"confirm": "Confirm",
|
||||||
"reset": "Reset",
|
"reset": "Reset",
|
||||||
"language": "Language",
|
"language": "Language",
|
||||||
"version": "Version",
|
"version": "Version",
|
||||||
@ -58,7 +60,10 @@
|
|||||||
"fetching-data": "fetching data...",
|
"fetching-data": "fetching data...",
|
||||||
"upload": "Upload",
|
"upload": "Upload",
|
||||||
"preview": "Preview",
|
"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": {
|
||||||
"archived-memos": "Archived Memos",
|
"archived-memos": "Archived Memos",
|
||||||
@ -91,7 +96,17 @@
|
|||||||
"new-filter": "New Filter",
|
"new-filter": "New Filter",
|
||||||
"eligible-memo": "eligible memo",
|
"eligible-memo": "eligible memo",
|
||||||
"fill-previous": "Please fill in previous filter value",
|
"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": {
|
"tag-list": {
|
||||||
"tip-text": "Enter `#tag ` to create"
|
"tip-text": "Enter `#tag ` to create"
|
||||||
|
@ -7,9 +7,11 @@
|
|||||||
"repeat-new-password": "重复新密码",
|
"repeat-new-password": "重复新密码",
|
||||||
"username": "用户名",
|
"username": "用户名",
|
||||||
"save": "保存",
|
"save": "保存",
|
||||||
|
"close": "关闭",
|
||||||
"cancel": "退出",
|
"cancel": "退出",
|
||||||
"create": "创建",
|
"create": "创建",
|
||||||
"change": "修改",
|
"change": "修改",
|
||||||
|
"confirm": "确定",
|
||||||
"reset": "重置",
|
"reset": "重置",
|
||||||
"language": "语言",
|
"language": "语言",
|
||||||
"version": "版本",
|
"version": "版本",
|
||||||
@ -58,7 +60,10 @@
|
|||||||
"fetching-data": "请求数据中...",
|
"fetching-data": "请求数据中...",
|
||||||
"upload": "上传",
|
"upload": "上传",
|
||||||
"preview": "预览",
|
"preview": "预览",
|
||||||
"copy-link": "拷贝链接"
|
"copy-link": "拷贝链接",
|
||||||
|
"delete-resource": "删除资源",
|
||||||
|
"warning-text": "确定删除这个资源么?此操作不可逆❗️",
|
||||||
|
"linked-amount": "链接的 Memo 数量"
|
||||||
},
|
},
|
||||||
"archived": {
|
"archived": {
|
||||||
"archived-memos": "已归档的 Memo",
|
"archived-memos": "已归档的 Memo",
|
||||||
@ -91,7 +96,17 @@
|
|||||||
"new-filter": "新建过滤器",
|
"new-filter": "新建过滤器",
|
||||||
"eligible-memo": "符合条件的 memo",
|
"eligible-memo": "符合条件的 memo",
|
||||||
"fill-previous": "请填写之前的过滤值",
|
"fill-previous": "请填写之前的过滤值",
|
||||||
"title-required": "标题是必填项。"
|
"title-required": "标题是必填项。",
|
||||||
|
"operator": {
|
||||||
|
"contains": "包含",
|
||||||
|
"not-contains": "不包含",
|
||||||
|
"is": "是",
|
||||||
|
"is-not": "不是"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"not-tagged": "无标签",
|
||||||
|
"linked": "包含链接"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"tag-list": {
|
"tag-list": {
|
||||||
"tip-text": "输入`#tag `来创建标签"
|
"tip-text": "输入`#tag `来创建标签"
|
||||||
|
Reference in New Issue
Block a user