@fresh-editor/fresh-editor 0.1.67 → 0.1.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +2 -0
  3. package/package.json +1 -1
  4. package/plugins/audit_mode.i18n.json +380 -0
  5. package/plugins/audit_mode.ts +836 -68
  6. package/plugins/buffer_modified.i18n.json +32 -0
  7. package/plugins/buffer_modified.ts +5 -3
  8. package/plugins/calculator.i18n.json +44 -0
  9. package/plugins/calculator.ts +6 -4
  10. package/plugins/clangd-lsp.ts +2 -0
  11. package/plugins/clangd_support.i18n.json +104 -0
  12. package/plugins/clangd_support.ts +18 -16
  13. package/plugins/color_highlighter.i18n.json +68 -0
  14. package/plugins/color_highlighter.ts +12 -10
  15. package/plugins/config-schema.json +25 -140
  16. package/plugins/csharp-lsp.ts +2 -0
  17. package/plugins/csharp_support.i18n.json +38 -0
  18. package/plugins/csharp_support.ts +6 -4
  19. package/plugins/css-lsp.ts +2 -0
  20. package/plugins/diagnostics_panel.i18n.json +110 -0
  21. package/plugins/diagnostics_panel.ts +19 -17
  22. package/plugins/find_references.i18n.json +128 -0
  23. package/plugins/find_references.ts +22 -20
  24. package/plugins/git_blame.i18n.json +230 -0
  25. package/plugins/git_blame.ts +39 -37
  26. package/plugins/git_find_file.i18n.json +146 -0
  27. package/plugins/git_find_file.ts +24 -22
  28. package/plugins/git_grep.i18n.json +80 -0
  29. package/plugins/git_grep.ts +15 -13
  30. package/plugins/git_gutter.i18n.json +44 -0
  31. package/plugins/git_gutter.ts +7 -5
  32. package/plugins/git_log.i18n.json +224 -0
  33. package/plugins/git_log.ts +41 -39
  34. package/plugins/go-lsp.ts +2 -0
  35. package/plugins/html-lsp.ts +2 -0
  36. package/plugins/json-lsp.ts +2 -0
  37. package/plugins/lib/fresh.d.ts +53 -13
  38. package/plugins/lib/index.ts +1 -1
  39. package/plugins/lib/navigation-controller.ts +3 -3
  40. package/plugins/lib/panel-manager.ts +15 -13
  41. package/plugins/lib/virtual-buffer-factory.ts +84 -112
  42. package/plugins/live_grep.i18n.json +80 -0
  43. package/plugins/live_grep.ts +15 -13
  44. package/plugins/markdown_compose.i18n.json +104 -0
  45. package/plugins/markdown_compose.ts +17 -15
  46. package/plugins/merge_conflict.i18n.json +380 -0
  47. package/plugins/merge_conflict.ts +72 -73
  48. package/plugins/path_complete.i18n.json +38 -0
  49. package/plugins/path_complete.ts +6 -4
  50. package/plugins/python-lsp.ts +2 -0
  51. package/plugins/rust-lsp.ts +2 -0
  52. package/plugins/search_replace.i18n.json +188 -0
  53. package/plugins/search_replace.ts +31 -29
  54. package/plugins/test_i18n.i18n.json +12 -0
  55. package/plugins/test_i18n.ts +18 -0
  56. package/plugins/theme_editor.i18n.json +1417 -0
  57. package/plugins/theme_editor.ts +73 -69
  58. package/plugins/todo_highlighter.i18n.json +86 -0
  59. package/plugins/todo_highlighter.ts +15 -13
  60. package/plugins/typescript-lsp.ts +2 -0
  61. package/plugins/vi_mode.i18n.json +716 -0
  62. package/plugins/vi_mode.ts +1195 -78
  63. package/plugins/welcome.i18n.json +110 -0
  64. package/plugins/welcome.ts +18 -16
@@ -1,4 +1,6 @@
1
1
  /// <reference path="../types/fresh.d.ts" />
2
+ const editor = getEditor();
3
+
2
4
 
3
5
  /**
4
6
  * Find References Plugin (TypeScript)
@@ -78,16 +80,16 @@ function buildPanelEntries(): TextPropertyEntry[] {
78
80
 
79
81
  // Header with symbol name
80
82
  const totalCount = currentReferences.length;
81
- const limitNote = totalCount >= MAX_RESULTS ? ` (limited to ${MAX_RESULTS})` : "";
83
+ const limitNote = totalCount >= MAX_RESULTS ? editor.t("panel.limited", { max: String(MAX_RESULTS) }) : "";
82
84
  const symbolDisplay = currentSymbol ? `'${currentSymbol}'` : "symbol";
83
85
  entries.push({
84
- text: `═══ References to ${symbolDisplay} (${totalCount}${limitNote}) ═══\n`,
86
+ text: `═══ ${editor.t("panel.header", { symbol: symbolDisplay, count: String(totalCount), limit: limitNote })} ═══\n`,
85
87
  properties: { type: "header" },
86
88
  });
87
89
 
88
90
  if (currentReferences.length === 0) {
89
91
  entries.push({
90
- text: " No references found\n",
92
+ text: " " + editor.t("panel.no_references") + "\n",
91
93
  properties: { type: "empty" },
92
94
  });
93
95
  } else {
@@ -115,7 +117,7 @@ function buildPanelEntries(): TextPropertyEntry[] {
115
117
  properties: { type: "separator" },
116
118
  });
117
119
  entries.push({
118
- text: `[↑/↓] navigate [RET] jump [q/Esc] close\n`,
120
+ text: editor.t("panel.help") + "\n",
119
121
  properties: { type: "help" },
120
122
  });
121
123
 
@@ -202,15 +204,15 @@ async function showReferencesPanel(symbol: string, references: ReferenceItem[]):
202
204
  referencesSplitId = editor.getActiveSplitId();
203
205
 
204
206
  const limitMsg = references.length > MAX_RESULTS
205
- ? ` (showing first ${MAX_RESULTS})`
207
+ ? editor.t("status.showing_first", { max: String(MAX_RESULTS) })
206
208
  : "";
207
209
  editor.setStatus(
208
- `Found ${references.length} reference(s)${limitMsg} - ↑/↓ navigate, RET jump, q close`
210
+ editor.t("status.found_references", { count: String(references.length), limit: limitMsg })
209
211
  );
210
212
  editor.debug(`References panel opened with buffer ID ${referencesBufferId}, split ID ${referencesSplitId}`);
211
213
  } catch (error) {
212
214
  const errorMessage = error instanceof Error ? error.message : String(error);
213
- editor.setStatus("Failed to open references panel");
215
+ editor.setStatus(editor.t("status.failed_open_panel"));
214
216
  editor.debug(`ERROR: createVirtualBufferInSplit failed: ${errorMessage}`);
215
217
  }
216
218
  }
@@ -220,7 +222,7 @@ globalThis.on_lsp_references = function (data: { symbol: string; locations: Refe
220
222
  editor.debug(`Received ${data.locations.length} references for '${data.symbol}'`);
221
223
 
222
224
  if (data.locations.length === 0) {
223
- editor.setStatus(`No references found for '${data.symbol}'`);
225
+ editor.setStatus(editor.t("status.no_references", { symbol: data.symbol }));
224
226
  return;
225
227
  }
226
228
 
@@ -254,7 +256,7 @@ globalThis.on_references_cursor_moved = function (data: {
254
256
  const refIndex = cursorLine - 1;
255
257
 
256
258
  if (refIndex >= 0 && refIndex < currentReferences.length) {
257
- editor.setStatus(`Reference ${refIndex + 1}/${currentReferences.length}`);
259
+ editor.setStatus(editor.t("status.reference_index", { current: String(refIndex + 1), total: String(currentReferences.length) }));
258
260
  }
259
261
  };
260
262
 
@@ -283,18 +285,18 @@ globalThis.hide_references_panel = function (): void {
283
285
  currentReferences = [];
284
286
  currentSymbol = "";
285
287
  lineCache.clear();
286
- editor.setStatus("References panel closed");
288
+ editor.setStatus(editor.t("status.closed"));
287
289
  };
288
290
 
289
291
  // Navigation: go to selected reference (based on cursor position)
290
292
  globalThis.references_goto = function (): void {
291
293
  if (currentReferences.length === 0) {
292
- editor.setStatus("No references to jump to");
294
+ editor.setStatus(editor.t("status.no_references_to_jump"));
293
295
  return;
294
296
  }
295
297
 
296
298
  if (sourceSplitId === null) {
297
- editor.setStatus("Source split not available");
299
+ editor.setStatus(editor.t("status.source_split_unavailable"));
298
300
  return;
299
301
  }
300
302
 
@@ -321,14 +323,14 @@ globalThis.references_goto = function (): void {
321
323
  location.column || 0
322
324
  );
323
325
  const displayPath = getRelativePath(location.file);
324
- editor.setStatus(`Jumped to ${displayPath}:${location.line}`);
326
+ editor.setStatus(editor.t("status.jumped_to", { file: displayPath, line: String(location.line) }));
325
327
  } else {
326
328
  editor.debug(`references_goto: no location in props[0]`);
327
- editor.setStatus("Move cursor to a reference line");
329
+ editor.setStatus(editor.t("status.move_cursor"));
328
330
  }
329
331
  } else {
330
332
  editor.debug(`references_goto: no props found at cursor`);
331
- editor.setStatus("Move cursor to a reference line");
333
+ editor.setStatus(editor.t("status.move_cursor"));
332
334
  }
333
335
  };
334
336
 
@@ -339,19 +341,19 @@ globalThis.references_close = function (): void {
339
341
 
340
342
  // Register commands
341
343
  editor.registerCommand(
342
- "Show References Panel",
343
- "Display current references",
344
+ "%cmd.show_references",
345
+ "%cmd.show_references_desc",
344
346
  "show_references_panel",
345
347
  "normal"
346
348
  );
347
349
 
348
350
  editor.registerCommand(
349
- "Hide References Panel",
350
- "Close the references panel",
351
+ "%cmd.hide_references",
352
+ "%cmd.hide_references_desc",
351
353
  "hide_references_panel",
352
354
  "normal"
353
355
  );
354
356
 
355
357
  // Plugin initialization
356
- editor.setStatus("Find References plugin loaded");
358
+ editor.setStatus(editor.t("status.ready"));
357
359
  editor.debug("Find References plugin initialized");
@@ -0,0 +1,230 @@
1
+ {
2
+ "en": {
3
+ "cmd.git_blame": "Git Blame",
4
+ "cmd.git_blame_desc": "Show git blame for current file (magit-style)",
5
+ "cmd.git_blame_close": "Git Blame: Close",
6
+ "cmd.git_blame_close_desc": "Close the git blame panel",
7
+ "cmd.git_blame_go_back": "Git Blame: Go Back",
8
+ "cmd.git_blame_go_back_desc": "Show blame at parent commit of current line",
9
+
10
+ "status.already_open": "Git blame already open",
11
+ "status.loading": "Loading git blame...",
12
+ "status.no_file": "No file open to blame",
13
+ "status.no_blame_info": "No blame information available (not a git file or error)",
14
+ "status.failed_open": "Failed to open git blame panel",
15
+ "status.closed": "Git blame closed",
16
+ "status.blame_ready": "Git blame: {count} blocks | b: blame at parent | q: close",
17
+ "status.move_to_line": "Move cursor to a blame line first",
18
+ "status.not_committed": "This line is not yet committed",
19
+ "status.loading_parent": "Loading blame at {hash}^...",
20
+ "status.cannot_go_back": "Cannot get blame at {hash}^ (may be initial commit or file didn't exist)",
21
+ "status.blame_at_parent": "Git blame at {hash}^ | depth: {depth} | b: go deeper | q: close",
22
+ "status.hash_copied": "Copied: {short} ({full})",
23
+ "status.hash_display": "Hash: {hash}",
24
+ "status.git_error": "Git blame error: {error}",
25
+
26
+ "time.just_now": "just now",
27
+ "time.minutes_ago": "{count} minute ago",
28
+ "time.minutes_ago_plural": "{count} minutes ago",
29
+ "time.hours_ago": "{count} hour ago",
30
+ "time.hours_ago_plural": "{count} hours ago",
31
+ "time.days_ago": "{count} day ago",
32
+ "time.days_ago_plural": "{count} days ago",
33
+ "time.weeks_ago": "{count} week ago",
34
+ "time.weeks_ago_plural": "{count} weeks ago",
35
+ "time.months_ago": "{count} month ago",
36
+ "time.months_ago_plural": "{count} months ago",
37
+ "time.years_ago": "{count} year ago",
38
+ "time.years_ago_plural": "{count} years ago"
39
+ },
40
+ "es": {
41
+ "cmd.git_blame": "Git Blame",
42
+ "cmd.git_blame_desc": "Mostrar git blame del archivo actual (estilo magit)",
43
+ "cmd.git_blame_close": "Git Blame: Cerrar",
44
+ "cmd.git_blame_close_desc": "Cerrar el panel de git blame",
45
+ "cmd.git_blame_go_back": "Git Blame: Retroceder",
46
+ "cmd.git_blame_go_back_desc": "Mostrar blame en el commit padre de la linea actual",
47
+
48
+ "status.already_open": "Git blame ya esta abierto",
49
+ "status.loading": "Cargando git blame...",
50
+ "status.no_file": "No hay archivo abierto para blame",
51
+ "status.no_blame_info": "No hay informacion de blame disponible (no es un archivo git o hay un error)",
52
+ "status.failed_open": "Error al abrir el panel de git blame",
53
+ "status.closed": "Git blame cerrado",
54
+ "status.blame_ready": "Git blame: {count} bloques | b: blame en padre | q: cerrar",
55
+ "status.move_to_line": "Primero mueve el cursor a una linea de blame",
56
+ "status.not_committed": "Esta linea aun no esta comprometida",
57
+ "status.loading_parent": "Cargando blame en {hash}^...",
58
+ "status.cannot_go_back": "No se puede obtener blame en {hash}^ (puede ser el commit inicial o el archivo no existia)",
59
+ "status.blame_at_parent": "Git blame en {hash}^ | profundidad: {depth} | b: ir mas profundo | q: cerrar",
60
+ "status.hash_copied": "Copiado: {short} ({full})",
61
+ "status.hash_display": "Hash: {hash}",
62
+ "status.git_error": "Error de git blame: {error}",
63
+
64
+ "time.just_now": "ahora mismo",
65
+ "time.minutes_ago": "hace {count} minuto",
66
+ "time.minutes_ago_plural": "hace {count} minutos",
67
+ "time.hours_ago": "hace {count} hora",
68
+ "time.hours_ago_plural": "hace {count} horas",
69
+ "time.days_ago": "hace {count} dia",
70
+ "time.days_ago_plural": "hace {count} dias",
71
+ "time.weeks_ago": "hace {count} semana",
72
+ "time.weeks_ago_plural": "hace {count} semanas",
73
+ "time.months_ago": "hace {count} mes",
74
+ "time.months_ago_plural": "hace {count} meses",
75
+ "time.years_ago": "hace {count} ano",
76
+ "time.years_ago_plural": "hace {count} anos"
77
+ },
78
+ "de": {
79
+ "cmd.git_blame": "Git Blame",
80
+ "cmd.git_blame_desc": "Git blame fuer aktuelle Datei anzeigen (Magit-Stil)",
81
+ "cmd.git_blame_close": "Git Blame: Schliessen",
82
+ "cmd.git_blame_close_desc": "Git blame Panel schliessen",
83
+ "cmd.git_blame_go_back": "Git Blame: Zurueck",
84
+ "cmd.git_blame_go_back_desc": "Blame beim Eltern-Commit der aktuellen Zeile anzeigen",
85
+
86
+ "status.already_open": "Git blame bereits geoeffnet",
87
+ "status.loading": "Lade git blame...",
88
+ "status.no_file": "Keine Datei zum Blamen geoeffnet",
89
+ "status.no_blame_info": "Keine Blame-Informationen verfuegbar (keine Git-Datei oder Fehler)",
90
+ "status.failed_open": "Git blame Panel konnte nicht geoeffnet werden",
91
+ "status.closed": "Git blame geschlossen",
92
+ "status.blame_ready": "Git blame: {count} Bloecke | b: Blame bei Eltern | q: schliessen",
93
+ "status.move_to_line": "Zuerst Cursor auf eine Blame-Zeile bewegen",
94
+ "status.not_committed": "Diese Zeile ist noch nicht committet",
95
+ "status.loading_parent": "Lade blame bei {hash}^...",
96
+ "status.cannot_go_back": "Kann blame bei {hash}^ nicht abrufen (moeglicherweise initialer Commit oder Datei existierte nicht)",
97
+ "status.blame_at_parent": "Git blame bei {hash}^ | Tiefe: {depth} | b: tiefer gehen | q: schliessen",
98
+ "status.hash_copied": "Kopiert: {short} ({full})",
99
+ "status.hash_display": "Hash: {hash}",
100
+ "status.git_error": "Git blame Fehler: {error}",
101
+
102
+ "time.just_now": "gerade eben",
103
+ "time.minutes_ago": "vor {count} Minute",
104
+ "time.minutes_ago_plural": "vor {count} Minuten",
105
+ "time.hours_ago": "vor {count} Stunde",
106
+ "time.hours_ago_plural": "vor {count} Stunden",
107
+ "time.days_ago": "vor {count} Tag",
108
+ "time.days_ago_plural": "vor {count} Tagen",
109
+ "time.weeks_ago": "vor {count} Woche",
110
+ "time.weeks_ago_plural": "vor {count} Wochen",
111
+ "time.months_ago": "vor {count} Monat",
112
+ "time.months_ago_plural": "vor {count} Monaten",
113
+ "time.years_ago": "vor {count} Jahr",
114
+ "time.years_ago_plural": "vor {count} Jahren"
115
+ },
116
+ "fr": {
117
+ "cmd.git_blame": "Git Blame",
118
+ "cmd.git_blame_desc": "Afficher git blame pour le fichier actuel (style magit)",
119
+ "cmd.git_blame_close": "Git Blame: Fermer",
120
+ "cmd.git_blame_close_desc": "Fermer le panneau git blame",
121
+ "cmd.git_blame_go_back": "Git Blame: Retour",
122
+ "cmd.git_blame_go_back_desc": "Afficher le blame au commit parent de la ligne actuelle",
123
+
124
+ "status.already_open": "Git blame deja ouvert",
125
+ "status.loading": "Chargement de git blame...",
126
+ "status.no_file": "Aucun fichier ouvert pour blame",
127
+ "status.no_blame_info": "Aucune information de blame disponible (pas un fichier git ou erreur)",
128
+ "status.failed_open": "Echec de l'ouverture du panneau git blame",
129
+ "status.closed": "Git blame ferme",
130
+ "status.blame_ready": "Git blame: {count} blocs | b: blame au parent | q: fermer",
131
+ "status.move_to_line": "Deplacez d'abord le curseur sur une ligne de blame",
132
+ "status.not_committed": "Cette ligne n'est pas encore commitee",
133
+ "status.loading_parent": "Chargement du blame a {hash}^...",
134
+ "status.cannot_go_back": "Impossible d'obtenir le blame a {hash}^ (peut etre le commit initial ou le fichier n'existait pas)",
135
+ "status.blame_at_parent": "Git blame a {hash}^ | profondeur: {depth} | b: aller plus loin | q: fermer",
136
+ "status.hash_copied": "Copie: {short} ({full})",
137
+ "status.hash_display": "Hash: {hash}",
138
+ "status.git_error": "Erreur git blame: {error}",
139
+
140
+ "time.just_now": "a l'instant",
141
+ "time.minutes_ago": "il y a {count} minute",
142
+ "time.minutes_ago_plural": "il y a {count} minutes",
143
+ "time.hours_ago": "il y a {count} heure",
144
+ "time.hours_ago_plural": "il y a {count} heures",
145
+ "time.days_ago": "il y a {count} jour",
146
+ "time.days_ago_plural": "il y a {count} jours",
147
+ "time.weeks_ago": "il y a {count} semaine",
148
+ "time.weeks_ago_plural": "il y a {count} semaines",
149
+ "time.months_ago": "il y a {count} mois",
150
+ "time.months_ago_plural": "il y a {count} mois",
151
+ "time.years_ago": "il y a {count} an",
152
+ "time.years_ago_plural": "il y a {count} ans"
153
+ },
154
+ "ja": {
155
+ "cmd.git_blame": "Git Blame",
156
+ "cmd.git_blame_desc": "現在のファイルのgit blameを表示(magitスタイル)",
157
+ "cmd.git_blame_close": "Git Blame: 閉じる",
158
+ "cmd.git_blame_close_desc": "git blameパネルを閉じる",
159
+ "cmd.git_blame_go_back": "Git Blame: 戻る",
160
+ "cmd.git_blame_go_back_desc": "現在の行の親コミットでblameを表示",
161
+
162
+ "status.already_open": "Git blameは既に開いています",
163
+ "status.loading": "Git blameを読み込み中...",
164
+ "status.no_file": "blameするファイルが開かれていません",
165
+ "status.no_blame_info": "blame情報がありません(gitファイルではないかエラーです)",
166
+ "status.failed_open": "Git blameパネルを開けませんでした",
167
+ "status.closed": "Git blameを閉じました",
168
+ "status.blame_ready": "Git blame: {count}ブロック | b: 親でblame | q: 閉じる",
169
+ "status.move_to_line": "まずカーソルをblame行に移動してください",
170
+ "status.not_committed": "この行はまだコミットされていません",
171
+ "status.loading_parent": "{hash}^でblameを読み込み中...",
172
+ "status.cannot_go_back": "{hash}^でblameを取得できません(初期コミットかファイルが存在しなかった可能性があります)",
173
+ "status.blame_at_parent": "Git blame {hash}^ | 深さ: {depth} | b: さらに深く | q: 閉じる",
174
+ "status.hash_copied": "コピーしました: {short} ({full})",
175
+ "status.hash_display": "ハッシュ: {hash}",
176
+ "status.git_error": "Git blameエラー: {error}",
177
+
178
+ "time.just_now": "たった今",
179
+ "time.minutes_ago": "{count}分前",
180
+ "time.minutes_ago_plural": "{count}分前",
181
+ "time.hours_ago": "{count}時間前",
182
+ "time.hours_ago_plural": "{count}時間前",
183
+ "time.days_ago": "{count}日前",
184
+ "time.days_ago_plural": "{count}日前",
185
+ "time.weeks_ago": "{count}週間前",
186
+ "time.weeks_ago_plural": "{count}週間前",
187
+ "time.months_ago": "{count}ヶ月前",
188
+ "time.months_ago_plural": "{count}ヶ月前",
189
+ "time.years_ago": "{count}年前",
190
+ "time.years_ago_plural": "{count}年前"
191
+ },
192
+ "zh": {
193
+ "cmd.git_blame": "Git Blame",
194
+ "cmd.git_blame_desc": "显示当前文件的git blame(magit风格)",
195
+ "cmd.git_blame_close": "Git Blame: 关闭",
196
+ "cmd.git_blame_close_desc": "关闭git blame面板",
197
+ "cmd.git_blame_go_back": "Git Blame: 返回",
198
+ "cmd.git_blame_go_back_desc": "显示当前行的父提交的blame",
199
+
200
+ "status.already_open": "Git blame已经打开",
201
+ "status.loading": "正在加载git blame...",
202
+ "status.no_file": "没有打开的文件可以blame",
203
+ "status.no_blame_info": "没有可用的blame信息(不是git文件或出错)",
204
+ "status.failed_open": "无法打开git blame面板",
205
+ "status.closed": "Git blame已关闭",
206
+ "status.blame_ready": "Git blame: {count}个块 | b: 在父提交blame | q: 关闭",
207
+ "status.move_to_line": "请先将光标移动到blame行",
208
+ "status.not_committed": "此行尚未提交",
209
+ "status.loading_parent": "正在加载{hash}^的blame...",
210
+ "status.cannot_go_back": "无法获取{hash}^的blame(可能是初始提交或文件不存在)",
211
+ "status.blame_at_parent": "Git blame {hash}^ | 深度: {depth} | b: 更深入 | q: 关闭",
212
+ "status.hash_copied": "已复制: {short} ({full})",
213
+ "status.hash_display": "哈希: {hash}",
214
+ "status.git_error": "Git blame错误: {error}",
215
+
216
+ "time.just_now": "刚刚",
217
+ "time.minutes_ago": "{count}分钟前",
218
+ "time.minutes_ago_plural": "{count}分钟前",
219
+ "time.hours_ago": "{count}小时前",
220
+ "time.hours_ago_plural": "{count}小时前",
221
+ "time.days_ago": "{count}天前",
222
+ "time.days_ago_plural": "{count}天前",
223
+ "time.weeks_ago": "{count}周前",
224
+ "time.weeks_ago_plural": "{count}周前",
225
+ "time.months_ago": "{count}个月前",
226
+ "time.months_ago_plural": "{count}个月前",
227
+ "time.years_ago": "{count}年前",
228
+ "time.years_ago_plural": "{count}年前"
229
+ }
230
+ }
@@ -1,4 +1,6 @@
1
1
  /// <reference path="../types/fresh.d.ts" />
2
+ const editor = getEditor();
3
+
2
4
 
3
5
  /**
4
6
  * Git Blame Plugin - Magit-style Git Blame Interface
@@ -125,7 +127,7 @@ async function fetchGitBlame(filePath: string, commit: string | null): Promise<B
125
127
  const result = await editor.spawnProcess("git", args);
126
128
 
127
129
  if (result.exit_code !== 0) {
128
- editor.setStatus(`Git blame error: ${result.stderr}`);
130
+ editor.setStatus(editor.t("status.git_error", { error: result.stderr }));
129
131
  return [];
130
132
  }
131
133
 
@@ -215,25 +217,25 @@ function formatRelativeDate(timestamp: number): string {
215
217
  const diff = now - timestamp;
216
218
 
217
219
  if (diff < 60) {
218
- return "just now";
220
+ return editor.t("time.just_now");
219
221
  } else if (diff < 3600) {
220
- const mins = Math.floor(diff / 60);
221
- return `${mins} minute${mins > 1 ? "s" : ""} ago`;
222
+ const count = Math.floor(diff / 60);
223
+ return editor.t(count > 1 ? "time.minutes_ago_plural" : "time.minutes_ago", { count: String(count) });
222
224
  } else if (diff < 86400) {
223
- const hours = Math.floor(diff / 3600);
224
- return `${hours} hour${hours > 1 ? "s" : ""} ago`;
225
+ const count = Math.floor(diff / 3600);
226
+ return editor.t(count > 1 ? "time.hours_ago_plural" : "time.hours_ago", { count: String(count) });
225
227
  } else if (diff < 604800) {
226
- const days = Math.floor(diff / 86400);
227
- return `${days} day${days > 1 ? "s" : ""} ago`;
228
+ const count = Math.floor(diff / 86400);
229
+ return editor.t(count > 1 ? "time.days_ago_plural" : "time.days_ago", { count: String(count) });
228
230
  } else if (diff < 2592000) {
229
- const weeks = Math.floor(diff / 604800);
230
- return `${weeks} week${weeks > 1 ? "s" : ""} ago`;
231
+ const count = Math.floor(diff / 604800);
232
+ return editor.t(count > 1 ? "time.weeks_ago_plural" : "time.weeks_ago", { count: String(count) });
231
233
  } else if (diff < 31536000) {
232
- const months = Math.floor(diff / 2592000);
233
- return `${months} month${months > 1 ? "s" : ""} ago`;
234
+ const count = Math.floor(diff / 2592000);
235
+ return editor.t(count > 1 ? "time.months_ago_plural" : "time.months_ago", { count: String(count) });
234
236
  } else {
235
- const years = Math.floor(diff / 31536000);
236
- return `${years} year${years > 1 ? "s" : ""} ago`;
237
+ const count = Math.floor(diff / 31536000);
238
+ return editor.t(count > 1 ? "time.years_ago_plural" : "time.years_ago", { count: String(count) });
237
239
  }
238
240
  }
239
241
 
@@ -404,7 +406,7 @@ function addBlameHeaders(): void {
404
406
  */
405
407
  globalThis.show_git_blame = async function(): Promise<void> {
406
408
  if (blameState.isOpen) {
407
- editor.setStatus("Git blame already open");
409
+ editor.setStatus(editor.t("status.already_open"));
408
410
  return;
409
411
  }
410
412
 
@@ -412,11 +414,11 @@ globalThis.show_git_blame = async function(): Promise<void> {
412
414
  const activeBufferId = editor.getActiveBufferId();
413
415
  const filePath = editor.getBufferPath(activeBufferId);
414
416
  if (!filePath || filePath === "") {
415
- editor.setStatus("No file open to blame");
417
+ editor.setStatus(editor.t("status.no_file"));
416
418
  return;
417
419
  }
418
420
 
419
- editor.setStatus("Loading git blame...");
421
+ editor.setStatus(editor.t("status.loading"));
420
422
 
421
423
  // Store state before opening blame
422
424
  blameState.splitId = editor.getActiveSplitId();
@@ -432,7 +434,7 @@ globalThis.show_git_blame = async function(): Promise<void> {
432
434
  ]);
433
435
 
434
436
  if (blameLines.length === 0) {
435
- editor.setStatus("No blame information available (not a git file or error)");
437
+ editor.setStatus(editor.t("status.no_blame_info"));
436
438
  resetState();
437
439
  return;
438
440
  }
@@ -494,11 +496,11 @@ globalThis.show_git_blame = async function(): Promise<void> {
494
496
  // Add virtual lines for blame headers (persistent state model)
495
497
  addBlameHeaders();
496
498
 
497
- editor.setStatus(`Git blame: ${blameState.blocks.length} blocks | b: blame at parent | q: close`);
499
+ editor.setStatus(editor.t("status.blame_ready", { count: String(blameState.blocks.length) }));
498
500
  editor.debug("Git blame panel opened with virtual lines architecture");
499
501
  } else {
500
502
  resetState();
501
- editor.setStatus("Failed to open git blame panel");
503
+ editor.setStatus(editor.t("status.failed_open"));
502
504
  }
503
505
  };
504
506
 
@@ -538,7 +540,7 @@ globalThis.git_blame_close = function(): void {
538
540
  blameState.bufferId = null;
539
541
  resetState();
540
542
 
541
- editor.setStatus("Git blame closed");
543
+ editor.setStatus(editor.t("status.closed"));
542
544
  };
543
545
 
544
546
  /**
@@ -569,17 +571,17 @@ globalThis.git_blame_go_back = async function(): Promise<void> {
569
571
 
570
572
  const currentHash = getCommitAtCursor();
571
573
  if (!currentHash) {
572
- editor.setStatus("Move cursor to a blame line first");
574
+ editor.setStatus(editor.t("status.move_to_line"));
573
575
  return;
574
576
  }
575
577
 
576
578
  // Skip if this is the "not committed yet" hash (all zeros)
577
579
  if (currentHash === "0000000000000000000000000000000000000000") {
578
- editor.setStatus("This line is not yet committed");
580
+ editor.setStatus(editor.t("status.not_committed"));
579
581
  return;
580
582
  }
581
583
 
582
- editor.setStatus(`Loading blame at ${currentHash.slice(0, 7)}^...`);
584
+ editor.setStatus(editor.t("status.loading_parent", { hash: currentHash.slice(0, 7) }));
583
585
 
584
586
  // Get the parent commit
585
587
  const parentCommit = `${currentHash}^`;
@@ -600,7 +602,7 @@ globalThis.git_blame_go_back = async function(): Promise<void> {
600
602
  if (blameLines.length === 0) {
601
603
  // Pop the stack since we couldn't navigate
602
604
  blameState.commitStack.pop();
603
- editor.setStatus(`Cannot get blame at ${currentHash.slice(0, 7)}^ (may be initial commit or file didn't exist)`);
605
+ editor.setStatus(editor.t("status.cannot_go_back", { hash: currentHash.slice(0, 7) }));
604
606
  return;
605
607
  }
606
608
 
@@ -641,7 +643,7 @@ globalThis.git_blame_go_back = async function(): Promise<void> {
641
643
  }
642
644
 
643
645
  const depth = blameState.commitStack.length;
644
- editor.setStatus(`Git blame at ${currentHash.slice(0, 7)}^ | depth: ${depth} | b: go deeper | q: close`);
646
+ editor.setStatus(editor.t("status.blame_at_parent", { hash: currentHash.slice(0, 7), depth: String(depth) }));
645
647
  };
646
648
 
647
649
  /**
@@ -652,23 +654,23 @@ globalThis.git_blame_copy_hash = function(): void {
652
654
 
653
655
  const hash = getCommitAtCursor();
654
656
  if (!hash) {
655
- editor.setStatus("Move cursor to a blame line first");
657
+ editor.setStatus(editor.t("status.move_to_line"));
656
658
  return;
657
659
  }
658
660
 
659
661
  // Skip if this is the "not committed yet" hash
660
662
  if (hash === "0000000000000000000000000000000000000000") {
661
- editor.setStatus("This line is not yet committed");
663
+ editor.setStatus(editor.t("status.not_committed"));
662
664
  return;
663
665
  }
664
666
 
665
667
  // Use spawn to copy to clipboard
666
668
  editor.spawnProcess("sh", ["-c", `echo -n "${hash}" | xclip -selection clipboard 2>/dev/null || echo -n "${hash}" | pbcopy 2>/dev/null || echo -n "${hash}" | xsel --clipboard 2>/dev/null`])
667
669
  .then(() => {
668
- editor.setStatus(`Copied: ${hash.slice(0, 7)} (${hash})`);
670
+ editor.setStatus(editor.t("status.hash_copied", { short: hash.slice(0, 7), full: hash }));
669
671
  })
670
672
  .catch(() => {
671
- editor.setStatus(`Hash: ${hash}`);
673
+ editor.setStatus(editor.t("status.hash_display", { hash }));
672
674
  });
673
675
  };
674
676
 
@@ -677,22 +679,22 @@ globalThis.git_blame_copy_hash = function(): void {
677
679
  // =============================================================================
678
680
 
679
681
  editor.registerCommand(
680
- "Git Blame",
681
- "Show git blame for current file (magit-style)",
682
+ "%cmd.git_blame",
683
+ "%cmd.git_blame_desc",
682
684
  "show_git_blame",
683
685
  "normal"
684
686
  );
685
687
 
686
688
  editor.registerCommand(
687
- "Git Blame: Close",
688
- "Close the git blame panel",
689
+ "%cmd.git_blame_close",
690
+ "%cmd.git_blame_close_desc",
689
691
  "git_blame_close",
690
692
  "normal"
691
693
  );
692
694
 
693
695
  editor.registerCommand(
694
- "Git Blame: Go Back",
695
- "Show blame at parent commit of current line",
696
+ "%cmd.git_blame_go_back",
697
+ "%cmd.git_blame_go_back_desc",
696
698
  "git_blame_go_back",
697
699
  "normal"
698
700
  );
@@ -701,5 +703,5 @@ editor.registerCommand(
701
703
  // Plugin Initialization
702
704
  // =============================================================================
703
705
 
704
- editor.setStatus("Git Blame plugin loaded (virtual lines architecture)");
706
+ editor.setStatus(editor.t("status.ready"));
705
707
  editor.debug("Git Blame plugin initialized - Use 'Git Blame' command to open");