From e64866908ca50b0bbccacf9c33b1f707e01950a4 Mon Sep 17 00:00:00 2001 From: Right Jeong Date: Sun, 21 Jun 2026 10:44:28 +0900 Subject: [PATCH 1/5] i18n: extract canvas-management strings to locale keys (excalidraw-app/hooks/useCanvasManagement.ts) --- excalidraw-app/hooks/useCanvasManagement.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/excalidraw-app/hooks/useCanvasManagement.ts b/excalidraw-app/hooks/useCanvasManagement.ts index 870cdb7e4e1e..65e024358e72 100644 --- a/excalidraw-app/hooks/useCanvasManagement.ts +++ b/excalidraw-app/hooks/useCanvasManagement.ts @@ -1,5 +1,7 @@ import { useState, useCallback, useEffect } from "react"; +import { t } from "@excalidraw/excalidraw/i18n"; + import { CaptureUpdateAction } from "@excalidraw/element"; import type { ExcalidrawImperativeAPI } from "@excalidraw/excalidraw/types"; @@ -98,7 +100,7 @@ export const useCanvasManagement = ({ await refreshCanvases(); } catch (error: any) { if (error instanceof AuthError) { - setErrorMessage("您需要登录才能删除此画布。"); + setErrorMessage(t("canvasManagement.loginToDelete")); } else { setErrorMessage("Could not delete the canvas."); } @@ -137,7 +139,7 @@ export const useCanvasManagement = ({ setCurrentCanvasId(createdCanvas.id); } catch (error: any) { if (error instanceof AuthError) { - setErrorMessage("您需要登录才能创建新画布。"); + setErrorMessage(t("canvasManagement.loginToCreate")); } else { setErrorMessage("Could not create new canvas."); } @@ -162,7 +164,7 @@ export const useCanvasManagement = ({ } } catch (error: any) { if (error instanceof AuthError) { - setErrorMessage("您需要登录才能重命名此画布。"); + setErrorMessage(t("canvasManagement.loginToRename")); } else { setErrorMessage("Could not rename the canvas."); } @@ -200,7 +202,7 @@ export const useCanvasManagement = ({ setCurrentCanvasId(createdCanvas.id); } catch (error: any) { if (error instanceof AuthError) { - setErrorMessage("您需要登录才能另存为新画布。"); + setErrorMessage(t("canvasManagement.loginToSaveAs")); } else { setErrorMessage("Could not save as new canvas."); } From 5f2c28159ff3e7ca8963fec409923c80e8193720 Mon Sep 17 00:00:00 2001 From: Right Jeong Date: Sun, 21 Jun 2026 10:44:29 +0900 Subject: [PATCH 2/5] i18n: extract canvas-management strings to locale keys (excalidraw-app/utils/time.ts) --- excalidraw-app/utils/time.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/excalidraw-app/utils/time.ts b/excalidraw-app/utils/time.ts index 6abbaa279a02..6223437b147b 100644 --- a/excalidraw-app/utils/time.ts +++ b/excalidraw-app/utils/time.ts @@ -1,28 +1,30 @@ +import { t } from "@excalidraw/excalidraw/i18n"; + export const timeAgo = (date: string | number | Date): string => { const now = new Date(); const past = new Date(date); const diffInSeconds = Math.floor((now.getTime() - past.getTime()) / 1000); if (diffInSeconds < 10) { - return "刚刚"; + return t("timeAgo.justNow"); } if (diffInSeconds < 60) { - return `${diffInSeconds} 秒前`; + return t("timeAgo.secondsAgo", { count: diffInSeconds }); } const diffInMinutes = Math.floor(diffInSeconds / 60); if (diffInMinutes < 60) { - return `${diffInMinutes} 分钟前`; + return t("timeAgo.minutesAgo", { count: diffInMinutes }); } const diffInHours = Math.floor(diffInMinutes / 60); if (diffInHours < 24) { - return `${diffInHours} 小时前`; + return t("timeAgo.hoursAgo", { count: diffInHours }); } const diffInDays = Math.floor(diffInHours / 24); if (diffInDays < 7) { - return `${diffInDays} 天前`; + return t("timeAgo.daysAgo", { count: diffInDays }); } return new Date(date).toLocaleDateString(); From 8f55b2bbbc4de6fb7e3ccc975138b3ee9e31f0ee Mon Sep 17 00:00:00 2001 From: Right Jeong Date: Sun, 21 Jun 2026 10:44:30 +0900 Subject: [PATCH 3/5] i18n: extract canvas-management strings to locale keys (packages/excalidraw/locales/zh-CN.json) --- packages/excalidraw/locales/zh-CN.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/excalidraw/locales/zh-CN.json b/packages/excalidraw/locales/zh-CN.json index 2e752ff05dfc..5595fe53520e 100644 --- a/packages/excalidraw/locales/zh-CN.json +++ b/packages/excalidraw/locales/zh-CN.json @@ -533,5 +533,21 @@ "description": "目前仅支持流程图序列图类图。其他类型在 Excalidraw 中将以图像呈现。", "syntax": "Mermaid 语法", "preview": "预览" + }, + "myCreations": { + "noThumbnail": "空空如也" + }, + "timeAgo": { + "justNow": "刚刚", + "secondsAgo": "{{count}} 秒前", + "minutesAgo": "{{count}} 分钟前", + "hoursAgo": "{{count}} 小时前", + "daysAgo": "{{count}} 天前" + }, + "canvasManagement": { + "loginToDelete": "您需要登录才能删除此画布。", + "loginToCreate": "您需要登录才能创建新画布。", + "loginToRename": "您需要登录才能重命名此画布。", + "loginToSaveAs": "您需要登录才能另存为新画布。" } } From 301a38d741b2d011b38bfe57a6c47fb872278788 Mon Sep 17 00:00:00 2001 From: Right Jeong Date: Sun, 21 Jun 2026 10:44:32 +0900 Subject: [PATCH 4/5] i18n: extract canvas-management strings to locale keys (packages/excalidraw/locales/en.json) --- packages/excalidraw/locales/en.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/excalidraw/locales/en.json b/packages/excalidraw/locales/en.json index a05101a52df7..f514f2ad5629 100644 --- a/packages/excalidraw/locales/en.json +++ b/packages/excalidraw/locales/en.json @@ -653,5 +653,21 @@ }, "itemNotAvailable": "Command is not available...", "shortcutHint": "For Command palette, use {{shortcut}}" + }, + "myCreations": { + "noThumbnail": "No preview" + }, + "timeAgo": { + "justNow": "just now", + "secondsAgo": "{{count}}s ago", + "minutesAgo": "{{count}}m ago", + "hoursAgo": "{{count}}h ago", + "daysAgo": "{{count}}d ago" + }, + "canvasManagement": { + "loginToDelete": "You need to log in to delete this canvas.", + "loginToCreate": "You need to log in to create a new canvas.", + "loginToRename": "You need to log in to rename this canvas.", + "loginToSaveAs": "You need to log in to save as a new canvas." } } From c76da97d070302d4a2d63b0ceca2aa4b29efecbe Mon Sep 17 00:00:00 2001 From: Right Jeong Date: Sun, 21 Jun 2026 10:44:33 +0900 Subject: [PATCH 5/5] i18n: extract canvas-management strings to locale keys (excalidraw-app/components/MyCreationsTab.tsx) --- excalidraw-app/components/MyCreationsTab.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/excalidraw-app/components/MyCreationsTab.tsx b/excalidraw-app/components/MyCreationsTab.tsx index 678698fcbee1..c5fb3a10d2e3 100644 --- a/excalidraw-app/components/MyCreationsTab.tsx +++ b/excalidraw-app/components/MyCreationsTab.tsx @@ -1,5 +1,7 @@ import React from "react"; +import { t } from "@excalidraw/excalidraw/i18n"; + import clsx from "clsx"; import { FilledButton } from "@excalidraw/excalidraw/components/FilledButton"; @@ -82,7 +84,7 @@ export const MyCreationsTab: React.FC = ({ /> ) : (
- 空空如也 + {t("myCreations.noThumbnail")}
)}