mirror of
https://github.com/usememos/memos.git
synced 2025-02-19 12:50:41 +01:00
chore: localization improvements (#3213)
* localization improvements * typo fix * fix linting error
This commit is contained in:
parent
755d5b83c6
commit
257b8add8c
@ -1,6 +1,7 @@
|
|||||||
import { Tooltip } from "@mui/joy";
|
import { Tooltip } from "@mui/joy";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { getNormalizedDateString, getDateWithOffset } from "@/helpers/datetime";
|
import { getNormalizedDateString, getDateWithOffset } from "@/helpers/datetime";
|
||||||
|
import { useTranslate } from "@/utils/i18n";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
// Format: 2021-1
|
// Format: 2021-1
|
||||||
@ -25,6 +26,7 @@ const getCellAdditionalStyles = (count: number, maxCount: number) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ActivityCalendar = (props: Props) => {
|
const ActivityCalendar = (props: Props) => {
|
||||||
|
const t = useTranslate();
|
||||||
const { month: monthStr, data, onClick } = props;
|
const { month: monthStr, data, onClick } = props;
|
||||||
const year = new Date(monthStr).getUTCFullYear();
|
const year = new Date(monthStr).getUTCFullYear();
|
||||||
const month = new Date(monthStr).getUTCMonth() + 1;
|
const month = new Date(monthStr).getUTCMonth() + 1;
|
||||||
@ -52,7 +54,7 @@ const ActivityCalendar = (props: Props) => {
|
|||||||
);
|
);
|
||||||
const count = data[date] || 0;
|
const count = data[date] || 0;
|
||||||
const isToday = new Date().toDateString() === new Date(date).toDateString();
|
const isToday = new Date().toDateString() === new Date(date).toDateString();
|
||||||
const tooltipText = count ? `${count} memos in ${date}` : date;
|
const tooltipText = count ? t("memo.count-memos-in-date", { count: count, date: date }) : date;
|
||||||
return day ? (
|
return day ? (
|
||||||
<Tooltip className="shrink-0" key={`${date}-${index}`} title={tooltipText} placement="top" arrow>
|
<Tooltip className="shrink-0" key={`${date}-${index}`} title={tooltipText} placement="top" arrow>
|
||||||
<div
|
<div
|
||||||
|
@ -93,7 +93,7 @@ const TagsSection = () => {
|
|||||||
<div className="p-2 border rounded-md flex flex-row justify-start items-start gap-1 text-gray-400 dark:text-gray-500">
|
<div className="p-2 border rounded-md flex flex-row justify-start items-start gap-1 text-gray-400 dark:text-gray-500">
|
||||||
<Icon.ThumbsUp />
|
<Icon.ThumbsUp />
|
||||||
<p className="mt-0.5 text-sm leading-snug italic">
|
<p className="mt-0.5 text-sm leading-snug italic">
|
||||||
You can create tags by inputting <code>`#tag`</code>.
|
{t("tag.create-tags-guide")}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@ -130,8 +130,8 @@ const TagItemContainer: React.FC<TagItemContainerProps> = (props: TagItemContain
|
|||||||
|
|
||||||
const handleDeleteTag = async () => {
|
const handleDeleteTag = async () => {
|
||||||
showCommonDialog({
|
showCommonDialog({
|
||||||
title: "Delete Tag",
|
title: t("tag.delete-tag"),
|
||||||
content: "Are you sure to delete this tag?",
|
content: t("tag.delete-confirm"),
|
||||||
style: "danger",
|
style: "danger",
|
||||||
dialogName: "delete-tag-dialog",
|
dialogName: "delete-tag-dialog",
|
||||||
onConfirm: async () => {
|
onConfirm: async () => {
|
||||||
|
@ -69,7 +69,7 @@ const MemoCommentMessage = ({ inbox }: Props) => {
|
|||||||
["status"],
|
["status"],
|
||||||
);
|
);
|
||||||
if (!silence) {
|
if (!silence) {
|
||||||
toast.success("Archived");
|
toast.success(t("message.archived-successfully"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ const VersionUpdateMessage = ({ inbox }: Props) => {
|
|||||||
["status"],
|
["status"],
|
||||||
);
|
);
|
||||||
if (!silence) {
|
if (!silence) {
|
||||||
toast.success("Archived");
|
toast.success(t("message.archived-successfully"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ const MemoActionMenu = (props: Props) => {
|
|||||||
dialogName: "delete-memo-dialog",
|
dialogName: "delete-memo-dialog",
|
||||||
onConfirm: async () => {
|
onConfirm: async () => {
|
||||||
await memoStore.deleteMemo(memo.name);
|
await memoStore.deleteMemo(memo.name);
|
||||||
toast.success("Deleted successfully");
|
toast.success(t("message.deleted-successfully"));
|
||||||
if (isInMemoDetailPage) {
|
if (isInMemoDetailPage) {
|
||||||
navigateTo("/");
|
navigateTo("/");
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import toast from "react-hot-toast";
|
|||||||
import showCreateMemoRelationDialog from "@/components/CreateMemoRelationDialog";
|
import showCreateMemoRelationDialog from "@/components/CreateMemoRelationDialog";
|
||||||
import Icon from "@/components/Icon";
|
import Icon from "@/components/Icon";
|
||||||
import { MemoRelation_Type } from "@/types/proto/api/v2/memo_relation_service";
|
import { MemoRelation_Type } from "@/types/proto/api/v2/memo_relation_service";
|
||||||
|
import { useTranslate } from "@/utils/i18n";
|
||||||
import { EditorRefActions } from "../Editor";
|
import { EditorRefActions } from "../Editor";
|
||||||
import { MemoEditorContext } from "../types";
|
import { MemoEditorContext } from "../types";
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ interface Props {
|
|||||||
const AddMemoRelationButton = (props: Props) => {
|
const AddMemoRelationButton = (props: Props) => {
|
||||||
const { editorRef } = props;
|
const { editorRef } = props;
|
||||||
const context = useContext(MemoEditorContext);
|
const context = useContext(MemoEditorContext);
|
||||||
|
const t = useTranslate();
|
||||||
|
|
||||||
const handleAddMemoRelationBtnClick = () => {
|
const handleAddMemoRelationBtnClick = () => {
|
||||||
showCreateMemoRelationDialog({
|
showCreateMemoRelationDialog({
|
||||||
@ -22,7 +24,7 @@ const AddMemoRelationButton = (props: Props) => {
|
|||||||
// If embedded mode is enabled, embed the memo instead of creating a relation.
|
// If embedded mode is enabled, embed the memo instead of creating a relation.
|
||||||
if (embedded) {
|
if (embedded) {
|
||||||
if (!editorRef.current) {
|
if (!editorRef.current) {
|
||||||
toast.error("Failed to embed memo");
|
toast.error(t("message.failed-to-embed-memo"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import useClickAway from "react-use/lib/useClickAway";
|
|||||||
import Icon from "@/components/Icon";
|
import Icon from "@/components/Icon";
|
||||||
import OverflowTip from "@/components/kit/OverflowTip";
|
import OverflowTip from "@/components/kit/OverflowTip";
|
||||||
import { useTagStore } from "@/store/module";
|
import { useTagStore } from "@/store/module";
|
||||||
|
import { useTranslate } from "@/utils/i18n";
|
||||||
import { EditorRefActions } from "../Editor";
|
import { EditorRefActions } from "../Editor";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -11,6 +12,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const TagSelector = (props: Props) => {
|
const TagSelector = (props: Props) => {
|
||||||
|
const t = useTranslate();
|
||||||
const { editorRef } = props;
|
const { editorRef } = props;
|
||||||
const tagStore = useTagStore();
|
const tagStore = useTagStore();
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
@ -74,7 +76,7 @@ const TagSelector = (props: Props) => {
|
|||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<p className="italic mx-2" onClick={(e) => e.stopPropagation()}>
|
<p className="italic mx-2" onClick={(e) => e.stopPropagation()}>
|
||||||
No tag found
|
{t("tag.no-tag-found")}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -138,7 +138,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
|
|||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
{props.showPinned && memo.pinned && (
|
{props.showPinned && memo.pinned && (
|
||||||
<Tooltip title={"Pinned"} placement="top">
|
<Tooltip title={t("common.pinned")} placement="top">
|
||||||
<Icon.Bookmark className="w-4 h-auto text-amber-500" />
|
<Icon.Bookmark className="w-4 h-auto text-amber-500" />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
"language": "Language",
|
"language": "Language",
|
||||||
"version": "Version",
|
"version": "Version",
|
||||||
"pin": "Pin",
|
"pin": "Pin",
|
||||||
|
"pinned": "Pinned",
|
||||||
"unpin": "Unpin",
|
"unpin": "Unpin",
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"restore": "Restore",
|
"restore": "Restore",
|
||||||
@ -106,7 +107,8 @@
|
|||||||
"no-comment": "No comment"
|
"no-comment": "No comment"
|
||||||
},
|
},
|
||||||
"show-more": "Show more",
|
"show-more": "Show more",
|
||||||
"wrapping": "Wrapping"
|
"wrapping": "Wrapping",
|
||||||
|
"count-memos-in-date": "{{count}} memos in {{date}}"
|
||||||
},
|
},
|
||||||
"reference": {
|
"reference": {
|
||||||
"add-references": "Add references",
|
"add-references": "Add references",
|
||||||
@ -153,13 +155,17 @@
|
|||||||
"tag": {
|
"tag": {
|
||||||
"tip-text": "Input `#tag` to create",
|
"tip-text": "Input `#tag` to create",
|
||||||
"create-tag": "Create Tag",
|
"create-tag": "Create Tag",
|
||||||
|
"delete-tag": "Delete Tag",
|
||||||
|
"delete-confirm": "Are you sure to delete this tag?",
|
||||||
"all-tags": "All Tags",
|
"all-tags": "All Tags",
|
||||||
"tag-name": "TAG_NAME",
|
"tag-name": "TAG_NAME",
|
||||||
"invalid-tag-name": "Invalid tag name",
|
"invalid-tag-name": "Invalid tag name",
|
||||||
"tag-suggestions": "Tag suggestions",
|
"tag-suggestions": "Tag suggestions",
|
||||||
|
"no-tag-found": "No tag found",
|
||||||
"show": "Show",
|
"show": "Show",
|
||||||
"hide": "Hide",
|
"hide": "Hide",
|
||||||
"save-all": "Save all"
|
"save-all": "Save all",
|
||||||
|
"create-tags-guide": "You can create tags by inputting `#tag`."
|
||||||
},
|
},
|
||||||
"timeline": {
|
"timeline": {
|
||||||
"title": "Timeline"
|
"title": "Timeline"
|
||||||
@ -318,11 +324,13 @@
|
|||||||
"memos-ready": "all memos are ready",
|
"memos-ready": "all memos are ready",
|
||||||
"resource-ready": "all resource are ready",
|
"resource-ready": "all resource are ready",
|
||||||
"archived-successfully": "Archived successfully",
|
"archived-successfully": "Archived successfully",
|
||||||
|
"deleted-successfully": "Deleted successfully",
|
||||||
"restored-successfully": "Restored successfully",
|
"restored-successfully": "Restored successfully",
|
||||||
"memo-updated-datetime": "Memo created datetime changed.",
|
"memo-updated-datetime": "Memo created datetime changed.",
|
||||||
"invalid-created-datetime": "Invalid created datetime.",
|
"invalid-created-datetime": "Invalid created datetime.",
|
||||||
"change-memo-created-time": "Change memo created time",
|
"change-memo-created-time": "Change memo created time",
|
||||||
"memo-not-found": "Memo not found.",
|
"memo-not-found": "Memo not found.",
|
||||||
|
"failed-to-embed-memo": "Failed to embed memo",
|
||||||
"fill-all": "Please fill in all fields.",
|
"fill-all": "Please fill in all fields.",
|
||||||
"password-not-match": "Passwords do not match.",
|
"password-not-match": "Passwords do not match.",
|
||||||
"new-password-not-match": "New passwords do not match.",
|
"new-password-not-match": "New passwords do not match.",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user