返回 DeepSeek-Reasonix
heartbeat.i18n.ts
根目录 / desktop / frontend / src / custom / features / heartbeat / heartbeat.i18n.ts
1 import { useCallback } from "react";
2 import { useI18n, type DictKey, type Locale } from "../../../lib/i18n";
3
4 export const heartbeatFeatureEn = {
5 "heartbeat.addTaskToScope": "Add task in {name}",
6 "heartbeat.btnNew": "New",
7 "heartbeat.btnPause": "Pause",
8 "heartbeat.btnStart": "Start",
9 "heartbeat.clickPause": "Click to pause",
10 "heartbeat.clickStart": "Click to start",
11 "heartbeat.cronAt": "at {time}",
12 "heartbeat.cronEveryHour": "every {n} hour(s)",
13 "heartbeat.cronEveryMin": "every {n} min",
14 "heartbeat.cronHourly": "hourly",
15 "heartbeat.cronNextRun": "Next run:",
16 "heartbeat.cronOnHour": "at minute {n} of every hour",
17 "heartbeat.cronPlaceholder": "0 * * * *",
18 "heartbeat.cronWeekdayFri": "Fri",
19 "heartbeat.cronWeekdayMon": "Mon",
20 "heartbeat.cronWeekdaySat": "Sat",
21 "heartbeat.cronWeekdaySun": "Sun",
22 "heartbeat.cronWeekdayThu": "Thu",
23 "heartbeat.cronWeekdayTue": "Tue",
24 "heartbeat.cronWeekdayWed": "Wed",
25 "heartbeat.cycleTime": "Time",
26 "heartbeat.cycleTimeAt": " (Time: {time})",
27 "heartbeat.daysAgo": "{n} d ago",
28 "heartbeat.detailTitle": "Task detail",
29 "heartbeat.discardChanges": "Discard unsaved changes?",
30 "heartbeat.dueSoon": "due soon",
31 "heartbeat.filterStatus": "Status",
32 "heartbeat.freqCron": "Custom",
33 "heartbeat.frequencyConversionFailed": "This schedule cannot be converted without changing when it runs.",
34 "heartbeat.heroSubtitle": "Let AI schedule tasks, set reminders, or monitor updates",
35 "heartbeat.heroTitle": "Automation",
36 "heartbeat.hoursAgo": "{n} hr ago",
37 "heartbeat.joinComma": ", ",
38 "heartbeat.later": "",
39 "heartbeat.minutesAgo": "{n} min ago",
40 "heartbeat.monthDay": "",
41 "heartbeat.newTask": "New",
42 "heartbeat.nextRun": "Next run in",
43 "heartbeat.promptRequired": "Add instructions so the task knows what to do.",
44 "heartbeat.remaining": "in ",
45 "heartbeat.runHistory": "Run history",
46 "heartbeat.runHistoryEmpty": "No runs yet",
47 "heartbeat.runHistoryNoTopic": "No conversation",
48 "heartbeat.saveFailed": "Could not save because automations changed elsewhere. Your draft is still here; review it and try again.",
49 "heartbeat.selectTask": "Select a task to view details",
50 "heartbeat.statusDisabled": "Paused",
51 "heartbeat.statusEnabled": "Active",
52 "heartbeat.sugDailyReview": "Daily review",
53 "heartbeat.sugDailyReviewDesc": "Read today's conversations across projects and review what was done, what's left, and tomorrow's plan",
54 "heartbeat.sugDailyReviewFreq": "Daily at 20:00",
55 "heartbeat.sugDailyReviewPrompt": "Read all of today's conversations and produce a multi-project review: what was completed, what issues remain, and what to do tomorrow. Output a structured review.",
56 "heartbeat.sugDownloads": "Downloads folder tidy-up report",
57 "heartbeat.sugDownloadsDesc": "Scan the downloads folder read-only and produce a categorized tidy-up report (no file moves)",
58 "heartbeat.sugDownloadsFreq": "Fridays at 16:00",
59 "heartbeat.sugDownloadsPrompt": "Scan the downloads folder of the current OS read-only (macOS/Linux: ~/Downloads, Windows: %USERPROFILE%\\Downloads), group files by type, and output a tidy-up suggestion report. Do not move or delete any files.",
60 "heartbeat.sugProductUpdate": "Product update digest",
61 "heartbeat.sugProductUpdateDesc": "Fetch the latest Reasonix release notes and learn about new capabilities",
62 "heartbeat.sugProductUpdateFreq": "Daily at 12:00",
63 "heartbeat.sugProductUpdatePrompt": "Visit https://reasonix.io/changelog/ to read the latest release notes, highlight recent new capabilities (New) and notable fixes in a bullet summary of at most 10 items. If the page is unreachable, fall back to release-notes/releases.json in the root of the local DeepSeek-Reasonix repository (if unsure where the repo is, locate the file with find).",
64 "heartbeat.suggestions": "Suggestions",
65 "heartbeat.suggestionsHint": "Create common automation tasks in one click",
66 "heartbeat.titleRequired": "Give the task a title to save it.",
67 "heartbeat.unitDay": "d",
68 "heartbeat.viewFlat": "Flat list",
69 "heartbeat.viewGrouped": "Group by project",
70 } as const;
71
72 export type HeartbeatFeatureKey = keyof typeof heartbeatFeatureEn;
73 export type HeartbeatTranslationKey = DictKey | HeartbeatFeatureKey;
74 export type HeartbeatTranslator = (
75 key: HeartbeatTranslationKey,
76 vars?: Record<string, string | number>,
77 ) => string;
78
79 const heartbeatFeatureZh = {
80 "heartbeat.addTaskToScope": "在 {name} 中添加任务",
81 "heartbeat.btnNew": "新建",
82 "heartbeat.btnPause": "暂停",
83 "heartbeat.btnStart": "启动",
84 "heartbeat.clickPause": "点击暂停",
85 "heartbeat.clickStart": "点击启动",
86 "heartbeat.cronAt": "在 {time}",
87 "heartbeat.cronEveryHour": "每{n}小时",
88 "heartbeat.cronEveryMin": "每{n}分钟",
89 "heartbeat.cronHourly": "整点",
90 "heartbeat.cronNextRun": "下次运行:",
91 "heartbeat.cronOnHour": "每小时 {n} 分",
92 "heartbeat.cronPlaceholder": "0 * * * *",
93 "heartbeat.cronWeekdayFri": "周五",
94 "heartbeat.cronWeekdayMon": "周一",
95 "heartbeat.cronWeekdaySat": "周六",
96 "heartbeat.cronWeekdaySun": "周日",
97 "heartbeat.cronWeekdayThu": "周四",
98 "heartbeat.cronWeekdayTue": "周二",
99 "heartbeat.cronWeekdayWed": "周三",
100 "heartbeat.cycleTime": "时间",
101 "heartbeat.cycleTimeAt": "(时间:{time})",
102 "heartbeat.daysAgo": "{n} 天前",
103 "heartbeat.detailTitle": "任务详情",
104 "heartbeat.discardChanges": "放弃未保存的修改?",
105 "heartbeat.dueSoon": "即将触发",
106 "heartbeat.filterStatus": "状态筛选",
107 "heartbeat.freqCron": "自定义",
108 "heartbeat.frequencyConversionFailed": "该调度无法在不改变运行时间的前提下转换。",
109 "heartbeat.heroSubtitle": "让 AI 安排任务、设置提醒或监测更新",
110 "heartbeat.heroTitle": "自动化",
111 "heartbeat.hoursAgo": "{n} 小时前",
112 "heartbeat.joinComma": "、",
113 "heartbeat.later": "后",
114 "heartbeat.minutesAgo": "{n} 分钟前",
115 "heartbeat.monthDay": "日",
116 "heartbeat.newTask": "新建",
117 "heartbeat.nextRun": "下次运行",
118 "heartbeat.promptRequired": "请填写任务要执行的内容。",
119 "heartbeat.remaining": "剩余",
120 "heartbeat.runHistory": "运行历史记录",
121 "heartbeat.runHistoryEmpty": "暂无执行记录",
122 "heartbeat.runHistoryNoTopic": "无会话",
123 "heartbeat.saveFailed": "自动化配置已在其他位置更改,本次保存失败。草稿仍已保留,请确认后重试。",
124 "heartbeat.selectTask": "选择一个任务查看详情",
125 "heartbeat.statusDisabled": "已暂停",
126 "heartbeat.statusEnabled": "活跃",
127 "heartbeat.sugDailyReview": "每日复盘",
128 "heartbeat.sugDailyReviewDesc": "读取今天所有项目的对话,复盘当天完成的工作、遗留问题与明日计划",
129 "heartbeat.sugDailyReviewFreq": "每天 20:00",
130 "heartbeat.sugDailyReviewPrompt": "读取今天的全部对话,按项目进行多项目复盘:今天完成了什么、有什么遗留问题、明天计划做什么。输出结构化复盘。",
131 "heartbeat.sugDownloads": "下载文件夹整理报告",
132 "heartbeat.sugDownloadsDesc": "只读扫描下载文件夹,生成分类整理建议(不移动文件)",
133 "heartbeat.sugDownloadsFreq": "每周五 16:00",
134 "heartbeat.sugDownloadsPrompt": "只读扫描当前操作系统的下载文件夹(macOS/Linux 为 ~/Downloads,Windows 为 %USERPROFILE%\\Downloads),按类型整理出分类清单,输出整理建议报告。不要移动或删除任何文件。",
135 "heartbeat.sugProductUpdate": "产品更新速览",
136 "heartbeat.sugProductUpdateDesc": "查询 Reasonix 最新发布说明,了解新能力与用法",
137 "heartbeat.sugProductUpdateFreq": "每天 12:00",
138 "heartbeat.sugProductUpdatePrompt": "访问 https://reasonix.io/changelog/ 查看最新的发布说明,重点介绍最近版本的新能力(New/新增)和重要修复,用要点式摘要输出,控制在 10 条以内。如果页面无法访问,改用本地 DeepSeek-Reasonix 代码仓库根目录下的 release-notes/releases.json 兜底(若不确定仓库位置,用 find 命令搜索该文件)。",
139 "heartbeat.suggestions": "建议",
140 "heartbeat.suggestionsHint": "一键创建常用自动化任务",
141 "heartbeat.titleRequired": "请填写任务标题后再保存。",
142 "heartbeat.unitDay": "天",
143 "heartbeat.viewFlat": "纯列表",
144 "heartbeat.viewGrouped": "按项目分组",
145 } satisfies Record<HeartbeatFeatureKey, string>;
146
147 const heartbeatFeatureZhTW = {
148 "heartbeat.addTaskToScope": "在 {name} 中添加任务",
149 "heartbeat.btnNew": "新增",
150 "heartbeat.btnPause": "暫停",
151 "heartbeat.btnStart": "啟動",
152 "heartbeat.clickPause": "點擊暫停",
153 "heartbeat.clickStart": "點擊啟動",
154 "heartbeat.cronAt": "在 {time}",
155 "heartbeat.cronEveryHour": "每{n}小時",
156 "heartbeat.cronEveryMin": "每{n}分鐘",
157 "heartbeat.cronHourly": "整點",
158 "heartbeat.cronNextRun": "下次運行:",
159 "heartbeat.cronOnHour": "每小時 {n} 分",
160 "heartbeat.cronPlaceholder": "0 * * * *",
161 "heartbeat.cronWeekdayFri": "週五",
162 "heartbeat.cronWeekdayMon": "週一",
163 "heartbeat.cronWeekdaySat": "週六",
164 "heartbeat.cronWeekdaySun": "週日",
165 "heartbeat.cronWeekdayThu": "週四",
166 "heartbeat.cronWeekdayTue": "週二",
167 "heartbeat.cronWeekdayWed": "週三",
168 "heartbeat.cycleTime": "時間",
169 "heartbeat.cycleTimeAt": "(時間:{time})",
170 "heartbeat.daysAgo": "{n} 天前",
171 "heartbeat.detailTitle": "任務詳情",
172 "heartbeat.discardChanges": "放棄未儲存的修改?",
173 "heartbeat.dueSoon": "即將觸發",
174 "heartbeat.filterStatus": "狀態篩選",
175 "heartbeat.freqCron": "自訂",
176 "heartbeat.frequencyConversionFailed": "該排程無法在不改變執行時間的前提下轉換。",
177 "heartbeat.heroSubtitle": "讓 AI 安排任務、設定提醒或監測更新",
178 "heartbeat.heroTitle": "自動化",
179 "heartbeat.hoursAgo": "{n} 小時前",
180 "heartbeat.joinComma": "、",
181 "heartbeat.later": "後",
182 "heartbeat.minutesAgo": "{n} 分鐘前",
183 "heartbeat.monthDay": "日",
184 "heartbeat.newTask": "新建",
185 "heartbeat.nextRun": "下次運行",
186 "heartbeat.promptRequired": "請填寫任務要執行的內容。",
187 "heartbeat.remaining": "剩餘",
188 "heartbeat.runHistory": "運行歷史記錄",
189 "heartbeat.runHistoryEmpty": "暫無執行記錄",
190 "heartbeat.runHistoryNoTopic": "無會話",
191 "heartbeat.saveFailed": "自動化設定已在其他位置變更,本次儲存失敗。草稿仍已保留,請確認後重試。",
192 "heartbeat.selectTask": "選擇一個任務查看詳情",
193 "heartbeat.statusDisabled": "已暫停",
194 "heartbeat.statusEnabled": "活躍",
195 "heartbeat.sugDailyReview": "每日覆盤",
196 "heartbeat.sugDailyReviewDesc": "讀取今天所有專案的對話,覆盤當天完成的工作、遺留問題與明日計劃",
197 "heartbeat.sugDailyReviewFreq": "每天 20:00",
198 "heartbeat.sugDailyReviewPrompt": "讀取今天的全部對話,按專案進行多專案覆盤:今天完成了什麼、有什麼遺留問題、明天計劃做什麼。輸出結構化覆盤。",
199 "heartbeat.sugDownloads": "下載資料夾整理報告",
200 "heartbeat.sugDownloadsDesc": "唯讀掃描下載資料夾,產生分類整理建議(不移動檔案)",
201 "heartbeat.sugDownloadsFreq": "每週五 16:00",
202 "heartbeat.sugDownloadsPrompt": "唯讀掃描目前作業系統的下載資料夾(macOS/Linux 為 ~/Downloads,Windows 為 %USERPROFILE%\\Downloads),按類型整理出分類清單,輸出整理建議報告。不要移動或刪除任何檔案。",
203 "heartbeat.sugProductUpdate": "產品更新速覽",
204 "heartbeat.sugProductUpdateDesc": "查詢 Reasonix 最新發佈說明,了解新能力與用法",
205 "heartbeat.sugProductUpdateFreq": "每天 12:00",
206 "heartbeat.sugProductUpdatePrompt": "訪問 https://reasonix.io/changelog/ 查看最新的發佈說明,重點介紹最近版本的新能力(New/新增)和重要修復,用要點式摘要輸出,控制在 10 條以內。如果頁面無法訪問,改用本地 DeepSeek-Reasonix 程式碼倉庫根目錄下的 release-notes/releases.json 兜底(若不確定倉庫位置,用 find 指令搜尋該檔案)。",
207 "heartbeat.suggestions": "建議",
208 "heartbeat.suggestionsHint": "一鍵建立常用自動化任務",
209 "heartbeat.titleRequired": "請填寫任務標題後再儲存。",
210 "heartbeat.unitDay": "天",
211 "heartbeat.viewFlat": "純列表",
212 "heartbeat.viewGrouped": "按專案分組",
213 } satisfies Record<HeartbeatFeatureKey, string>;
214
215 export const heartbeatFeatureKeys = Object.keys(heartbeatFeatureEn) as HeartbeatFeatureKey[];
216
217 const heartbeatFeatureDictionaries: Record<Locale, Record<HeartbeatFeatureKey, string>> = {
218 en: heartbeatFeatureEn,
219 zh: heartbeatFeatureZh,
220 "zh-TW": heartbeatFeatureZhTW,
221 };
222
223 function interpolate(message: string, vars?: Record<string, string | number>): string {
224 if (!vars) return message;
225 return message.replace(/\{(\w+)\}/g, (_, key) => (
226 vars[key] === undefined ? `{${key}}` : String(vars[key])
227 ));
228 }
229
230 export function useHeartbeatT(): HeartbeatTranslator {
231 const { locale, t } = useI18n();
232 return useCallback<HeartbeatTranslator>((key, vars) => {
233 const message = heartbeatFeatureDictionaries[locale][key as HeartbeatFeatureKey];
234 return message === undefined ? t(key as DictKey, vars) : interpolate(message, vars);
235 }, [locale, t]);
236 }
237
237 lines TYPESCRIPT