-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmagpt-i18n.el
More file actions
483 lines (468 loc) · 28.8 KB
/
magpt-i18n.el
File metadata and controls
483 lines (468 loc) · 28.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
;;; magpt-i18n.el --- i18n tables and helpers for MaGPT -*- lexical-binding: t; -*-
;; Centralizes localized UI messages for magpt.
;;; Code:
(require 'subr-x)
;; Forward decls from core
(declare-function magpt--maybe-load-rc "ext:magpt")
(declare-function magpt--log "ext:magpt" (fmt &rest args))
(defvar magpt-info-language "English"
"Preferred natural language for informative content (summaries, rationales) in assist tasks.")
(defun magpt--lang-code ()
"Return language code symbol based on `magpt-info-language'."
(let* ((raw (or (and (boundp 'magpt-info-language) magpt-info-language) "English"))
(l (downcase raw)))
(cond
;; Russian (ru / rus / russian / рус / русский)
((or (string-match-p "\\`ru\\b" l)
(string-match-p "\\`rus\\b" l)
(string-match-p "\\`russian\\b" l)
(string-match-p "рус" l)) 'ru)
;; Ukrainian (uk / ukrainian / укр / україн)
((or (string-match-p "\\`uk\\b" l)
(string-match-p "\\`ukrainian\\b" l)
(string-match-p "укр" l)
(string-match-p "україн" l)) 'uk)
;; Belarusian (be / belarusian / belorussian / бел / беларус)
((or (string-match-p "\\`be\\b" l)
(string-match-p "\\`belarusian\\b" l)
(string-match-p "\\`belorussian\\b" l)
(string-match-p "бел" l)
(string-match-p "беларус" l)) 'be)
;; Chinese (zh / chinese / 中文 / кит)
((or (string-match-p "\\`zh\\b" l)
(string-match-p "\\`chinese\\b" l)
(string-match-p "中文" raw)
(string-match-p "кит" l)) 'zh)
;; French kept for backward-compatibility if user sets it
((string-match-p "\\`fr\\b" l) 'fr)
;; Default English
(t 'en))))
;; English
(defconst magpt--i18n-en
'((confirm-send-full . "magpt: Send staged diff to LLM (%d bytes)? ")
(ai-ask-prompt . "Ask Git question: ")
;; Titles and toggles
(overview-title . "AI overview (magpt)")
(overview-toggle-show . "[Show rationale/steps]")
(overview-toggle-hide . "[Hide rationale/steps]")
(overview-run-dot-g . "[Run . g]")
(ai-actions-hint . "[.] AI actions")
(overview-extras-title . "More")
(overview-extras-hint-dot-g . "(Tip: run [. g] to collect status overview.)")
(overview-extras-no-data . "(No data for extra tasks yet)")
(confirm-send-trunc . "magpt: Send staged diff to LLM (original %d bytes; sending %d bytes after truncation)? ")
(request-llm-commit . "magpt: requesting LLM to generate commit message...")
(result-copied . "magpt: result copied to kill-ring and shown in *magpt-commit*")
(empty-response . "magpt: empty response from model")
(insertion-cancelled . "magpt: insertion cancelled by user")
(inserted-into-commit-buffer . "magpt: commit message inserted into commit buffer")
(inserted-into-buffer-named . "magpt: commit message inserted into %s")
(gptel-error . "magpt: error calling gptel: %s")
(gptel-error2 . "magpt/gptel error: %s")
(sending-cancelled . "magpt: sending cancelled by user")
(no-staged-changes . "No staged changes found (git add ...)")
(replace-current-commit-msg? . "Replace the current commit message and insert the generated one? ")
(callback-error . "magpt: error in callback: %s")
;; Overview/History (keys used by AI Overview)
(overview-response . "Response:")
(json-opened . "Opened response in JSON buffer")
(json-copied . "Response copied to kill-ring")
;; Section titles (localized UI)
(overview-summary . "Summary:")
(overview-risks . "Risks:")
(overview-suggestions . "Suggestions:")
(overview-lint-status . "Lint status:")
(overview-issues . "Issues:")
(overview-suggestion . "Suggestion:")
(overview-name . "Name:")
(overview-alternatives . "Alternatives:")
(overview-rationale . "Rationale:")
(overview-steps . "Steps:")
;; Card titles (localized UI)
(overview-card-commit-lint . "Commit Lint / Fix Suggest")
(overview-card-branch-name . "Branch Name Suggest")
(overview-card-resolve-conflict . "Resolve Conflict (here)")
(overview-card-push-pull . "Push/Pull advice")
(overview-card-branches . "Branches overview")
(overview-card-restore-file . "Recover file (how-to)")
(overview-card-ask-git . "Answer")
(overview-card-ask-git-to . "Answer to")
(overview-card-reset-files . "Reset files (how-to)")
(overview-card-stash . "Stash guide")
(overview-card-undo-commits . "Undo commits (reset vs revert)")
(overview-card-reflog-rescue . "Reflog rescue")
(overview-card-detached-head . "Detached HEAD help")
(overview-card-set-upstream . "Set upstream help")
(overview-no-data . "(no data)")
(overview-stale . "(status changed - press [. g] to refresh)")
(patch-opened . "Opened response in patch buffer")
;; Transient/AI Actions UI
(ai-suggest-prompt . "Suggestion: ")
(ai-suggest-copied . "magpt: suggestion commands copied")
(ai-summary-copied . "magpt: summary copied")
(ai-no-suggestions . "No suggestions found; run [. g], or u/b/f")
(ai-no-summary . "No summary available; run [. g], or u/b/f")
(ai-no-shell-cmd . "No shell command found in this suggestion")
(ai-eshell-helper-missing . "magpt: eshell helper not available (magpt-apply not loaded)")
(ai-eshell-inserted . "magpt: command inserted into eshell")
(ai-actions-reloaded . "magpt: AI actions reloaded from overview")
;; Task end-status
(task-done-json-ok . "magpt: %s done (JSON OK) — see AI overview")
(task-done-not-json . "magpt: %s done, but response is not JSON — open JSON to inspect") ))
;; Russian
(defconst magpt--i18n-ru
'((confirm-send-full . "magpt: Отправить staged‑дифф в LLM (%d байт)? ")
(ai-ask-prompt . "Вопрос к Git: ")
;; Titles and toggles
(overview-title . "AI-обзор (magpt)")
(overview-toggle-show . "[Показать обоснование/шаги]")
(overview-toggle-hide . "[Скрыть обоснование/шаги]")
(overview-run-dot-g . "[Запустить . g]")
(ai-actions-hint . "[.] Действия ИИ")
(overview-extras-title . "Ещё")
(overview-extras-hint-dot-g . "(Рекомендуется запустить [. g] для сводки статуса.)")
(overview-extras-no-data . "(Пока нет данных по дополнительным задачам)")
(confirm-send-trunc . "magpt: Отправить staged‑дифф в LLM (исходно %d байт; отправим %d байт после усечения)? ")
(request-llm-commit . "magpt: запрашиваем LLM для генерации сообщения коммита...")
(result-copied . "magpt: результат показан в *magpt-commit* и скопирован в kill-ring")
(empty-response . "magpt: пустой ответ от модели")
(insertion-cancelled . "magpt: вставка отменена пользователем")
(inserted-into-commit-buffer . "magpt: сообщение коммита вставлено в буфер коммита")
(inserted-into-buffer-named . "magpt: сообщение коммита вставлено в %s")
(gptel-error . "magpt: ошибка вызова gptel: %s")
(gptel-error2 . "magpt/gptel ошибка: %s")
(sending-cancelled . "magpt: отправка отменена пользователем")
(no-staged-changes . "Нет застейдженных изменений (сделайте git add ...)")
(replace-current-commit-msg? . "Заменить текущее сообщение коммита и вставить сгенерированное? ")
(callback-error . "magpt: ошибка в callback: %s")
;; Обзор/История
(overview-response . "Ответ:")
(json-opened . "Ответ открыт в JSON буфере")
(json-copied . "Ответ скопирован в kill-ring")
;; Заголовки секций
(overview-summary . "Сводка:")
(overview-risks . "Риски:")
(overview-suggestions . "Рекомендации:")
(overview-lint-status . "Статус lint:")
(overview-issues . "Проблемы:")
(overview-suggestion . "Предложение:")
(overview-name . "Имя:")
(overview-alternatives . "Альтернативы:")
(overview-rationale . "Обоснование:")
(overview-steps . "Шаги:")
;; Заголовки карточек
(overview-card-commit-lint . "Линт коммита / правка")
(overview-card-branch-name . "Имя ветки (рекомендация)")
(overview-card-resolve-conflict . "Разрешить конфликт (здесь)")
(overview-card-push-pull . "Push/Pull — советы")
(overview-card-branches . "Обзор веток")
(overview-card-restore-file . "Восстановить файл (инструкция)")
(overview-card-ask-git . "Ответ")
(overview-card-ask-git-to . "Ответ на")
(overview-card-reset-files . "Сброс файлов (инструкция)")
(overview-card-stash . "Stash — руководство")
(overview-card-undo-commits . "Отмена коммитов (reset vs revert)")
(overview-card-reflog-rescue . "Reflog — спасение")
(overview-card-detached-head . "Detached HEAD — помощь")
(overview-card-set-upstream . "Upstream — настройка")
(overview-no-data . "(нет данных)")
(overview-stale . "(статус изменился - нажмите [. g] для обновления)")
(patch-opened . "Патч открыт в буфере")
;; Transient/AI Actions UI
(ai-suggest-prompt . "Подсказка: ")
(ai-suggest-copied . "magpt: команды подсказки скопированы")
(ai-summary-copied . "magpt: сводка скопирована")
(ai-no-suggestions . "Подсказки не найдены; выполните [. g] или u/b/f")
(ai-no-summary . "Сводка недоступна; выполните [. g] или u/b/f")
(ai-no-shell-cmd . "В этой подсказке нет команды оболочки")
(ai-eshell-helper-missing . "magpt: помощник eshell недоступен (magpt-apply не загружен)")
(ai-eshell-inserted . "magpt: команда вставлена в eshell")
(ai-actions-reloaded . "magpt: AI-действия обновлены из обзора")
;; Завершение задач
(task-done-json-ok . "magpt: %s выполнено (JSON OK) — смотрите AI-обзор")
(task-done-not-json . "magpt: %s выполнено, но ответ не JSON — откройте JSON для просмотра") ))
;; French (kept for compatibility)
(defconst magpt--i18n-fr
'((confirm-send-full . "magpt: Envoyer le diff indexé au LLM (%d octets) ? ")
(ai-ask-prompt . "Question Git : ")
;; Titles and toggles
(overview-title . "Vue d'ensemble IA (magpt)")
(overview-toggle-show . "[Afficher raisonnement/étapes]")
(overview-toggle-hide . "[Masquer raisonnement/étapes]")
(overview-run-dot-g . "[Exécuter . g]")
(ai-actions-hint . "[.] Actions IA")
(overview-extras-title . "Plus")
(overview-extras-hint-dot-g . "(Astuce : lancez [. g] pour récupérer le résumé de l'état.)")
(overview-extras-no-data . "(Aucune donnée pour les tâches supplémentaires)")
(confirm-send-trunc . "magpt: Envoyer le diff indexé au LLM (original %d octets ; envoi de %d octets après troncature) ? ")
(request-llm-commit . "magpt: demande au LLM de générer le message de commit...")
(result-copied . "magpt: résultat copié dans le kill-ring et affiché dans *magpt-commit*")
(empty-response . "magpt: réponse vide du modèle")
(insertion-cancelled . "magpt: insertion annulée par l'utilisateur")
(inserted-into-commit-buffer . "magpt: message de commit inséré dans le tampon de commit")
(inserted-into-buffer-named . "magpt: message de commit inséré dans %s")
(gptel-error . "magpt: erreur lors de l'appel à gptel : %s")
(gptel-error2 . "erreur magpt/gptel : %s")
(sending-cancelled . "magpt: envoi annulé par l'utilisateur")
(no-staged-changes . "Aucun changement indexé trouvé (git add ...)")
(replace-current-commit-msg? . "Remplacer le message de commit actuel et insérer celui généré ? ")
(callback-error . "magpt: erreur dans le callback : %s")
(overview-response . "Réponse :")
(json-opened . "Réponse ouverte dans un tampon JSON")
(json-copied . "Réponse copiée dans le kill-ring")
(overview-summary . "Résumé :")
(overview-risks . "Risques :")
(overview-suggestions . "Suggestions :")
(overview-lint-status . "Statut du lint :")
(overview-issues . "Problèmes :")
(overview-suggestion . "Suggestion :")
(overview-name . "Nom :")
(overview-alternatives . "Alternatives :")
(overview-rationale . "Justification :")
(overview-steps . "Étapes :")
(overview-card-commit-lint . "Commit Lint / Correction")
(overview-card-branch-name . "Suggestion de nom de branche")
(overview-card-resolve-conflict . "Résoudre le conflit (ici)")
(overview-card-push-pull . "Conseils Push/Pull")
(overview-card-branches . "Aperçu des branches")
(overview-card-restore-file . "Restaurer un fichier (guide)")
(overview-card-ask-git . "Réponse")
(overview-card-ask-git-to . "Réponse à")
(overview-card-reset-files . "Réinitialiser des fichiers (guide)")
(overview-no-data . "(aucune donnée)")
(overview-stale . "(état modifié — appuyez sur [. g] pour actualiser)")
(patch-opened . "Patch ouvert dans un tampon")
;; Transient/AI Actions UI
(ai-suggest-prompt . "Suggestion : ")
(ai-suggest-copied . "magpt : commandes de la suggestion copiées")
(ai-summary-copied . "magpt : résumé copié")
(ai-no-suggestions . "Aucune suggestion trouvée ; lancez [. g], ou u/b/f")
(ai-no-summary . "Aucun résumé disponible ; lancez [. g], ou u/b/f")
(ai-no-shell-cmd . "Aucune commande shell trouvée dans cette suggestion")
(ai-eshell-helper-missing . "magpt : aide eshell non disponible (magpt-apply non chargé)")
(ai-eshell-inserted . "magpt : commande insérée dans eshell")
(ai-actions-reloaded . "magpt : actions IA rechargées depuis l’aperçu")
;; Fin de tâche
(task-done-json-ok . "magpt : %s terminé (JSON OK) — voir l’aperçu IA")
(task-done-not-json . "magpt : %s terminé, mais la réponse n’est pas JSON — ouvrez le JSON pour inspecter") ))
;; Chinese (Simplified)
(defconst magpt--i18n-zh
'((confirm-send-full . "magpt:将已暂存的差异发送给 LLM(%d 字节)? ")
(ai-ask-prompt . "Git 问题:")
;; Titles and toggles
(overview-title . "AI 概览(magpt)")
(overview-toggle-show . "[显示 理由/步骤]")
(overview-toggle-hide . "[隐藏 理由/步骤]")
(overview-run-dot-g . "[运行 . g]")
(ai-actions-hint . "[.] AI 操作")
(overview-extras-title . "更多")
(overview-extras-hint-dot-g . "(提示:运行 [. g] 获取状态概览。)")
(overview-extras-no-data . "(暂时没有额外任务的数据)")
(confirm-send-trunc . "magpt:将已暂存的差异发送给 LLM(原始 %d 字节;截断后发送 %d 字节)? ")
(request-llm-commit . "magpt:请求 LLM 生成提交消息...")
(result-copied . "magpt:结果已显示在 *magpt-commit* 并复制到 kill-ring")
(empty-response . "magpt:模型返回空响应")
(insertion-cancelled . "magpt:用户取消了插入")
(inserted-into-commit-buffer . "magpt:提交消息已插入到提交缓冲区")
(inserted-into-buffer-named . "magpt:提交消息已插入到 %s")
(gptel-error . "magpt:调用 gptel 出错:%s")
(gptel-error2 . "magpt/gptel 错误:%s")
(sending-cancelled . "magpt:发送已取消")
(no-staged-changes . "没有已暂存的更改(请先运行 git add ...)")
(replace-current-commit-msg? . "替换当前提交消息并插入生成的内容? ")
(callback-error . "magpt:回调出错:%s")
(overview-response . "响应:")
(json-opened . "已在 JSON 缓冲区中打开响应")
(json-copied . "响应已复制到 kill-ring")
(overview-summary . "摘要:")
(overview-risks . "风险:")
(overview-suggestions . "建议:")
(overview-lint-status . "Lint 状态:")
(overview-issues . "问题:")
(overview-suggestion . "建议:")
(overview-name . "名称:")
(overview-alternatives . "备选:")
(overview-rationale . "理由:")
(overview-steps . "步骤:")
(overview-card-commit-lint . "提交 Lint / 修复建议")
(overview-card-branch-name . "分支名建议")
(overview-card-resolve-conflict . "解决冲突(此处)")
(overview-card-push-pull . "Push/Pull 建议")
(overview-card-branches . "分支概览")
(overview-card-restore-file . "恢复文件(指南)")
(overview-card-ask-git . "回答")
(overview-card-ask-git-to . "回答:")
(overview-card-reset-files . "重置文件(指南)")
(overview-no-data . "(没有数据)")
(overview-stale . "(状态已更改 — 按 [. g] 刷新)")
(patch-opened . "已在补丁缓冲区中打开响应")
;; Transient/AI Actions UI
(ai-suggest-prompt . "建议:")
(ai-suggest-copied . "magpt:建议命令已复制")
(ai-summary-copied . "magpt:摘要已复制")
(ai-no-suggestions . "未找到建议;运行 [. g] 或 u/b/f")
(ai-no-summary . "没有可用的摘要;运行 [. g] 或 u/b/f")
(ai-no-shell-cmd . "此建议中没有 shell 命令")
(ai-eshell-helper-missing . "magpt:eshell 帮助不可用(未加载 magpt-apply)")
(ai-eshell-inserted . "magpt:命令已插入到 eshell")
(ai-actions-reloaded . "magpt:AI 操作已从概览重新加载")
(task-done-json-ok . "magpt:%s 已完成(JSON 有效) — 请查看 AI 概览")
(task-done-not-json . "magpt:%s 已完成,但响应不是 JSON — 打开 JSON 检查")))
;; Ukrainian
(defconst magpt--i18n-uk
'((confirm-send-full . "magpt: Надіслати проіндексований diff до LLM (%d байт)? ")
(ai-ask-prompt . "Питання до Git: ")
;; Titles and toggles
(overview-title . "Огляд ШІ (magpt)")
(overview-toggle-show . "[Показати обґрунтування/кроки]")
(overview-toggle-hide . "[Приховати обґрунтування/кроки]")
(overview-run-dot-g . "[Запустити . g]")
(ai-actions-hint . "[.] Дії ШІ")
(overview-extras-title . "Ще")
(overview-extras-hint-dot-g . "(Порада: запустіть [. g], щоб зібрати огляд стану.)")
(overview-extras-no-data . "(Поки немає даних для додаткових задач)")
(confirm-send-trunc . "magpt: Надіслати проіндексований diff до LLM (спочатку %d байт; надішлемо %d байт після усікання)? ")
(request-llm-commit . "magpt: запит до LLM для генерації повідомлення коміту...")
(result-copied . "magpt: результат показано в *magpt-commit* і скопійовано в kill-ring")
(empty-response . "magpt: порожня відповідь від моделі")
(insertion-cancelled . "magpt: вставку скасовано користувачем")
(inserted-into-commit-buffer . "magpt: повідомлення коміту вставлено до буфера коміту")
(inserted-into-buffer-named . "magpt: повідомлення коміту вставлено до %s")
(gptel-error . "magpt: помилка виклику gptel: %s")
(gptel-error2 . "помилка magpt/gptel: %s")
(sending-cancelled . "magpt: надсилання скасовано користувачем")
(no-staged-changes . "Немає проіндексованих змін (зробіть git add ...)")
(replace-current-commit-msg? . "Замінити поточне повідомлення коміту та вставити згенероване? ")
(callback-error . "magpt: помилка у callback: %s")
(overview-response . "Відповідь:")
(json-opened . "Відповідь відкрито в JSON‑буфері")
(json-copied . "Відповідь скопійовано в kill-ring")
(overview-summary . "Стисло:")
(overview-risks . "Ризики:")
(overview-suggestions . "Рекомендації:")
(overview-lint-status . "Статус lint:")
(overview-issues . "Проблеми:")
(overview-suggestion . "Пропозиція:")
(overview-name . "Назва:")
(overview-alternatives . "Альтернативи:")
(overview-rationale . "Обґрунтування:")
(overview-steps . "Кроки:")
(overview-card-commit-lint . "Lint коміту / виправлення")
(overview-card-branch-name . "Назва гілки (рекомендація)")
(overview-card-resolve-conflict . "Розв’язати конфлікт (тут)")
(overview-card-push-pull . "Поради Push/Pull")
(overview-card-branches . "Огляд гілок")
(overview-card-restore-file . "Відновити файл (інструкція)")
(overview-card-ask-git . "Відповідь")
(overview-card-ask-git-to . "Відповідь на")
(overview-card-reset-files . "Скинути файли (інструкція)")
(overview-no-data . "(немає даних)")
(overview-stale . "(стан змінився — натисніть [. g] для оновлення)")
(patch-opened . "Відповідь відкрито в буфері патчу")
;; Transient/AI Actions UI
(ai-suggest-prompt . "Пропозиція: ")
(ai-suggest-copied . "magpt: команди пропозиції скопійовано")
(ai-summary-copied . "magpt: зведення скопійовано")
(ai-no-suggestions . "Пропозицій не знайдено; запустіть [. g] або u/b/f")
(ai-no-summary . "Немає зведення; запустіть [. g] або u/b/f")
(ai-no-shell-cmd . "У цій пропозиції немає команди оболонки")
(ai-eshell-helper-missing . "magpt: помічник eshell недоступний (magpt-apply не завантажено)")
(ai-eshell-inserted . "magpt: команду вставлено в eshell")
(ai-actions-reloaded . "magpt: дії ШІ перезавантажено з огляду")
(task-done-json-ok . "magpt: %s виконано (JSON OK) — див. AI‑огляд")
(task-done-not-json . "magpt: %s виконано, але відповідь не є JSON — відкрийте JSON для перевірки")))
;; Belarusian
(defconst magpt--i18n-be
'((confirm-send-full . "magpt: Адправіць праіндэксаваны diff у LLM (%d байт)? ")
(ai-ask-prompt . "Пытанне да Git: ")
;; Titles and toggles
(overview-title . "Агляд ШІ (magpt)")
(overview-toggle-show . "[Паказаць абгрунтаванне/крокі]")
(overview-toggle-hide . "[Схаваць абгрунтаванне/крокі]")
(overview-run-dot-g . "[Запусціць . g]")
(ai-actions-hint . "[.] Дзеянні ШІ")
(overview-extras-title . "Яшчэ")
(overview-extras-hint-dot-g . "(Парада: запусціце [. g], каб сабраць агляд стану.)")
(overview-extras-no-data . "(Пакуль няма даных па дадатковых задачах)")
(confirm-send-trunc . "magpt: Адправіць праіндэксаваны diff у LLM (першапачаткова %d байт; адправім %d байт пасля абразання)? ")
(request-llm-commit . "magpt: запытваем у LLM згенераваць паведамленне каміту...")
(result-copied . "magpt: вынік паказаны ў *magpt-commit* і скапіяваны ў kill-ring")
(empty-response . "magpt: пусты адказ ад мадэлі")
(insertion-cancelled . "magpt: устаўка адменена карыстальнікам")
(inserted-into-commit-buffer . "magpt: паведамленне каміту ўстаўлена ў буфер каміту")
(inserted-into-buffer-named . "magpt: паведамленне каміту ўстаўлена ў %s")
(gptel-error . "magpt: памылка выкліку gptel: %s")
(gptel-error2 . "памылка magpt/gptel: %s")
(sending-cancelled . "magpt: адпраўка адменена карыстальнікам")
(no-staged-changes . "Няма праіндэксаваных змен (зрабіце git add ...)")
(replace-current-commit-msg? . "Замяніць бягучае паведамленне каміту і ўставіць згенераванае? ")
(callback-error . "magpt: памылка ў callback: %s")
(overview-response . "Адказ:")
(json-opened . "Адказ адкрыты ў JSON‑буферы")
(json-copied . "Адказ скапіяваны ў kill-ring")
(overview-summary . "Зводка:")
(overview-risks . "Рызыкі:")
(overview-suggestions . "Рэкамендацыі:")
(overview-lint-status . "Статус lint:")
(overview-issues . "Праблемы:")
(overview-suggestion . "Прапановa:")
(overview-name . "Імя:")
(overview-alternatives . "Альтэрнатывы:")
(overview-rationale . "Абгрунтаванне:")
(overview-steps . "Крокі:")
(overview-card-commit-lint . "Lint каміту / выпраўленне")
(overview-card-branch-name . "Імя галіны (рэкамендацыя)")
(overview-card-resolve-conflict . "Вырашыць канфлікт (тут)")
(overview-card-push-pull . "Парады Push/Pull")
(overview-card-branches . "Агляд галінаў")
(overview-card-restore-file . "Аднавіць файл (інструкцыя)")
(overview-card-ask-git . "Адказ")
(overview-card-ask-git-to . "Адказ на")
(overview-card-reset-files . "Скінуць файлы (інструкцыя)")
(overview-no-data . "(няма даных)")
(overview-stale . "(стан змяніўся — націсніце [. g] для абнаўлення)")
(patch-opened . "Адказ адкрыты ў буферы патча")
;; Transient/AI Actions UI
(ai-suggest-prompt . "Прапанова: ")
(ai-suggest-copied . "magpt: каманды прапановы скапіраваны")
(ai-summary-copied . "magpt: зводку скапіявана")
(ai-no-suggestions . "Прапановы не знойдзены; запусціце [. g] або u/b/f")
(ai-no-summary . "Няма зводкі; запусціце [. g] або u/b/f")
(ai-no-shell-cmd . "У гэтай прапанове няма каманды абалонкі")
(ai-eshell-helper-missing . "magpt: памочнік eshell недаступны (magpt-apply не загружаны)")
(ai-eshell-inserted . "magpt: каманда ўстаўлена ў eshell")
(ai-actions-reloaded . "magpt: дзеянні ШІ перазагружаны з агляду")
(task-done-json-ok . "magpt: %s выканана (JSON OK) — гл. AI-агляд")
(task-done-not-json . "magpt: %s выканана, але адказ не з'яўляецца JSON — адкрыйце JSON для праверкі")))
(defun magpt--i18n (key &rest args)
"Format localized message for KEY with ARGS using `magpt-info-language'.
Never signal an error; fall back to a plain format string if formatting fails."
;; Best-effort: try to load user/project RC early so the language choice
;; (`magpt-info-language`) is respected during early UI rendering (e.g. Magit
;; overview at startup). This is silent and protected so it is safe when the
;; magpt core has not been fully initialized (e.g., during byte-compile or
;; partial reloads).
(ignore-errors
(when (fboundp 'magpt--maybe-load-rc)
(magpt--maybe-load-rc)))
(let* ((lang (magpt--lang-code))
(tbl (pcase lang
('ru magpt--i18n-ru)
('fr magpt--i18n-fr)
('zh magpt--i18n-zh)
('uk magpt--i18n-uk)
('be magpt--i18n-be)
(_ magpt--i18n-en)))
(fmt (or (alist-get key tbl) (alist-get key magpt--i18n-en) "")))
(when (fboundp 'magpt--log)
(ignore-errors
(magpt--log "i18n: key=%S lang=%S fmt=%s" key lang fmt)))
(condition-case _
(if args (apply #'format fmt args) fmt)
(error
;; Fallback: best-effort concatenate when format fails
(mapconcat #'identity
(cons fmt (mapcar (lambda (a) (format "%s" a)) args))
" ")))))
(provide 'magpt-i18n)
;;; magpt-i18n.el ends here