返回 DeepSeek-Reasonix
managementLocale.ts
根目录 / desktop / frontend / src / lib / managementLocale.ts
1 import { useCallback } from "react";
2 import { useI18n } from "./i18n";
3 const messages = {
4 back: ["返回工作区", "返回工作區", "Back to workspace"],
5 automationBack: ["返回自动化", "返回自動化", "Back to automation"],
6 listBack: ["返回列表", "返回列表", "Back to list"],
7 refresh: ["刷新", "重新整理", "Refresh"],
8 retry: ["重试", "重試", "Retry"],
9 cancel: ["取消", "取消", "Cancel"],
10 confirm: ["确认删除", "確認刪除", "Confirm deletion"],
11 loading: ["正在加载…", "正在載入…", "Loading…"],
12 loadFailed: ["加载失败,请重试。", "載入失敗,請重試。", "Could not load. Please retry."],
13 operationFailed: ["操作未完成,请重试。", "操作未完成,請重試。", "The operation did not complete. Please retry."],
14 refreshedFailed: ["操作已完成,但列表刷新失败。", "操作已完成,但列表重新整理失敗。", "Operation completed, but the list could not refresh."],
15 restored: ["会话已恢复", "會話已還原", "Conversation restored"],
16 deleted: ["已永久删除", "已永久刪除", "Permanently deleted"],
17 clearFilters: ["清除筛选", "清除篩選", "Clear filters"],
18 trashDescription: ["查看和恢复已删除的会话。", "查看與還原已刪除的會話。", "Review and restore deleted conversations."],
19 purgeTitle: ["永久删除会话", "永久刪除會話", "Permanently delete conversation"],
20 purgeDescription: ["删除“{name}”后无法恢复。", "刪除「{name}」後無法還原。", "Deleting “{name}” cannot be undone."],
21 clearTitle: ["清空回收站", "清空回收站", "Empty trash"],
22 clearDescription: ["将永久删除全部 {n} 条普通会话,包括筛选隐藏的条目。系统恢复数据不在其中。此操作无法撤销。", "將永久刪除全部 {n} 條一般會話,包括篩選隱藏的項目。系統復原資料不在其中。此操作無法復原。", "Permanently delete all {n} ordinary conversations, including filtered-out items. System recovery data is excluded. This cannot be undone."],
23 batchResult: ["已删除 {success} 条,{failed} 条未完成。", "已刪除 {success} 條,{failed} 條未完成。", "Deleted {success}; {failed} did not complete."],
24 retryFailed: ["仅重试失败项", "僅重試失敗項目", "Retry failed items"],
25 saved: ["已保存", "已儲存", "Saved"],
26 saving: ["保存中…", "儲存中…", "Saving…"],
27 unsaved: ["未保存", "未儲存", "Unsaved"],
28 noTasks: ["还没有自动化任务,创建一个任务开始。", "還沒有自動化任務,建立一個任務開始。", "No automations yet. Create a task to get started."],
29 drafts: ["草稿", "草稿", "Drafts"],
30 discard: ["放弃修改", "放棄修改", "Discard changes"],
31 configuration: ["任务配置", "任務設定", "Configuration"],
32 savedRun: ["按已保存配置运行", "依已儲存設定執行", "Runs with saved configuration"],
33 filteredDetail: ["当前任务不在筛选结果中", "目前任務不在篩選結果中", "This task is outside the current filters"],
34 conflict: ["此任务已在其他地方修改,部分字段与你的编辑冲突。", "此任務已在其他地方修改,部分欄位與你的編輯衝突。", "This task changed elsewhere. Some fields conflict with your edits."],
35 missingTask: ["此任务已被删除,你的草稿仍然保留。", "此任務已被刪除,你的草稿仍然保留。", "This task was deleted. Your draft is still available."],
36 reloadTask: ["加载最新配置", "載入最新設定", "Load latest configuration"],
37 saveAsNew: ["另存为新任务", "另存為新任務", "Save as new task"],
38 deleteTask: ["删除自动化任务", "刪除自動化任務", "Delete automation"],
39 deleteTaskDescription: ["删除“{name}”后将停止未来调度,已有会话会保留。", "刪除「{name}」後將停止未來排程,已有會話會保留。", "Deleting “{name}” stops future scheduling. Existing conversations are kept."],
40 historicalTitle: ["历史会话", "歷史對話", "Historical sessions"],
41 historicalDescription: ["原始文件已保留,这些记录不参与清空回收站。", "原始檔案已保留,這些記錄不參與清空回收站。", "Original files are preserved. These records are excluded from Empty trash."],
42 historicalImportDescription: ["打开时只导入所选会话,也可批量导入。原始文件始终保留,其他会话可正常使用。", "開啟時只匯入所選對話,也可批次匯入。保留原始檔案,其他對話仍可使用。", "Import a conversation when you open it, or import all. Original files are kept. Other conversations remain available."],
43 historicalImportAll: ["导入全部", "匯入全部", "Import all"],
44 historicalImportOpen: ["导入并打开", "匯入並開啟", "Import and open"],
45 historicalImportPause: ["完成当前项后暂停", "完成目前項目後暫停", "Pause after current item"],
46 historicalImportResume: ["继续导入", "繼續匯入", "Continue"],
47 historicalImportCancel: ["取消导入", "取消匯入", "Cancel import"],
48 historicalRemaining: ["剩余:", "剩餘:", "Remaining:"],
49 historicalSourceBusy: ["其他实例正在使用此会话,关闭后可重试。", "其他實例正在使用此對話,關閉後可重試。", "In use by another instance. Close it and retry."],
50 historicalImportFailed: ["导入失败,原件已保留。可重试或查看恢复详情。", "匯入失敗,原件已保留。可重試或檢視恢復詳情。", "Import failed. Original files are preserved; retry or review recovery details."],
51 historicalAvailable: ["尚未导入", "尚未匯入", "Not imported"],
52 historicalSourceUpdated: ["旧来源有更新,可导入为独立分支", "舊來源有更新,可匯入為獨立分支", "Historical source changed. Import as a separate branch."],
53 historicalQueued: ["排队中", "排隊中", "Queued"],
54 historicalImporting: ["正在导入", "正在匯入", "Importing"],
55 historicalImported: ["已导入", "已匯入", "Imported"],
56 historicalBlocked: ["被占用", "使用中", "In use"],
57 historicalNeedsAttention: ["需要处理", "需要處理", "Needs attention"],
58 historicalArchived: ["已归档", "已封存", "Archived"],
59 historicalDeleted: ["已删除", "已刪除", "Deleted"],
60 noHistoricalSessions: ["暂无待恢复的历史会话", "暫無待恢復的歷史對話", "No historical sessions awaiting recovery"],
61 branch: ["分支", "分支", "Branch"],
62 } as const;
63 export type ManagementKey = keyof typeof messages;
64 export function useManagementT() {
65 const { locale } = useI18n();
66 return useCallback((key: ManagementKey, vars?: Record<string, string | number>) => {
67 const text = messages[key][locale === "en" ? 2 : locale === "zh-TW" ? 1 : 0];
68 return text.replace(/\{(\w+)\}/g, (match, name: string) => vars?.[name] === undefined ? match : String(vars[name]));
69 }, [locale]);
70 }
71
71 lines TYPESCRIPT