fix(commands): localize diff feedback

Route diff messages and pager titles through the presentation facet and
provide translations in all 15 complete locale packs. Preserve the English
output, action behavior and raw diff payloads.

Refs #7071 (diff portion).
This commit is contained in:
laozidabo committed 2026-10-27 16:48:55 +08:00
1 parent 0cf390f01e
commit 887a3c669a
19 files changed
+240 -21

No files matched your search

+32 -2
View File
@@ -17,6 +17,34 @@ fn diff_formats_observations_without_host_state_or_actions() {
self.0.clone()
}
}
struct Presentation;
impl CommandPresentationContext for Presentation {
fn translate(&self, key: &str, replacements: &[(&str, &str)]) -> Result<String, String> {
let catalog: serde_json::Value =
serde_json::from_str(include_str!("../../../localization/locales/en.json"))
.unwrap();
let id: String = key
.split('_')
.map(|word| {
let mut chars = word.chars();
chars
.next()
.unwrap()
.to_uppercase()
.chain(chars)
.collect::<String>()
})
.collect();
let mut text = catalog[&id]
.as_str()
.ok_or_else(|| format!("unknown test key {key}"))?
.to_string();
for (name, value) in replacements {
text = text.replace(&format!("{{{name}}}"), value);
}
Ok(text)
}
}
let output =
|names: &str, stat: &str, patch: &str, patch_truncated| DebugDiffObservation::Output {
names: names.into(),
@@ -76,7 +104,9 @@ fn diff_formats_observations_without_host_state_or_actions() {
),
] {
let result = undo::diff(
CommandContexts::empty().with_debug_diff(&mut Diff(observation)),
CommandContexts::empty()
.with_debug_diff(&mut Diff(observation))
.with_presentation(&mut Presentation),
None,
);
assert_eq!(result.message.as_deref(), Some(message));
@@ -128,7 +158,7 @@ fn whole_group_has_exact_authority_and_safe_missing_facets() {
("system", Caps::DEBUG_DIAGNOSTICS),
("context", Caps::DEBUG_DIAGNOSTICS),
("edit", Caps::DEBUG_HISTORY),
("diff", Caps::DEBUG_DIFF),
("diff", Caps::DEBUG_DIFF | Caps::PRESENTATION),
("undo", Caps::DEBUG_UNDO | Caps::DEBUG_HISTORY),
("retry", Caps::DEBUG_HISTORY),
];
+46 -19
View File
@@ -44,7 +44,7 @@ registration!(
"/diff",
&[],
"cmd_diff_description",
Caps::DEBUG_DIFF,
Caps::DEBUG_DIFF.union(Caps::PRESENTATION),
diff
);
registration!(
@@ -122,14 +122,29 @@ pub(super) fn diff(contexts: CommandContexts<'_>, _: Option<&str>) -> CommandRes
let Some(diff) = parts.debug_diff.as_deref_mut() else {
return CommandResult::error("Command capability unavailable: debug_diff");
};
match diff.diff() {
DebugDiffObservation::GitUnavailable => CommandResult::error("git not found on PATH"),
DebugDiffObservation::NoBaseline => CommandResult::message(
"Nothing to compare yet: this session has not saved a restore point here, and this folder is not a git repository.",
),
DebugDiffObservation::Failed(error) => CommandResult::message(format!(
"Git diff failed — is this a git repository?\n{error}"
)),
let Some(presentation) = parts.presentation.as_deref_mut() else {
return CommandResult::error("Command capability unavailable: presentation");
};
match diff_report(diff.diff(), presentation) {
Ok(result) => result,
Err(error) => CommandResult::error(error),
}
}
fn diff_report(
observation: DebugDiffObservation,
presentation: &dyn CommandPresentationContext,
) -> Result<CommandResult, String> {
Ok(match observation {
DebugDiffObservation::GitUnavailable => {
CommandResult::error(presentation.translate("cmd_diff_git_unavailable", &[])?)
}
DebugDiffObservation::NoBaseline => {
CommandResult::message(presentation.translate("cmd_diff_no_baseline", &[])?)
}
DebugDiffObservation::Failed(error) => {
CommandResult::message(presentation.translate("cmd_diff_failed", &[("error", &error)])?)
}
DebugDiffObservation::Output {
names,
stat,
@@ -137,7 +152,9 @@ pub(super) fn diff(contexts: CommandContexts<'_>, _: Option<&str>) -> CommandRes
patch_truncated,
} => {
if names.trim().is_empty() {
return CommandResult::message("No changes since session start");
return Ok(CommandResult::message(
presentation.translate("cmd_diff_no_changes", &[])?,
));
}
let files: Vec<&str> = names.lines().filter(|l| !l.is_empty()).collect();
@@ -149,34 +166,44 @@ pub(super) fn diff(contexts: CommandContexts<'_>, _: Option<&str>) -> CommandRes
// modifications.
let renamed_count = files.iter().filter(|f| f.contains(" -> ")).count();
let summary = if renamed_count > 0 {
format!("Changed files ({file_count}, {renamed_count} renamed):\n{file_list}")
presentation.translate(
"cmd_diff_changed_files_renamed",
&[
("count", &file_count.to_string()),
("renamed", &renamed_count.to_string()),
("files", &file_list),
],
)?
} else {
format!("Changed files ({file_count}):\n{file_list}")
presentation.translate(
"cmd_diff_changed_files",
&[("count", &file_count.to_string()), ("files", &file_list)],
)?
};
let stat_str = stat.trim();
let mut message = summary;
if !stat_str.is_empty() {
message.push_str("\n\n── Stat ──\n");
let stat_header = presentation.translate("cmd_diff_stat_header", &[])?;
message.push_str(&format!("\n\n── {stat_header} ──\n"));
message.push_str(stat_str);
}
if patch_truncated {
message.push_str(
"\n\nThe diff is too long to show in full. The file list above is complete.",
);
message.push_str("\n\n");
message.push_str(&presentation.translate("cmd_diff_truncated", &[])?);
}
if patch.trim().is_empty() {
return CommandResult::message(message);
return Ok(CommandResult::message(message));
}
CommandResult::with_message_and_action(
message,
DebugAction::OpenDiffPager {
title: "Changes since session start".to_string(),
title: presentation.translate("cmd_diff_title", &[])?,
diff: patch,
},
)
}
}
})
}
/// A conversation undo that removed anything hands the truncated conversation
+9
View File
@@ -505,6 +505,15 @@
"CmdCostDescription": "Mostra el desglossament de costos de la sessió",
"CmdReceiptsDescription": "Mostra què ha fet aquesta sessió: fitxers, ordres, aprovacions",
"CmdDiffDescription": "Mostra els canvis en fitxers des de l'inici de la sessió",
"CmdDiffGitUnavailable": "No s’ha trobat git al PATH",
"CmdDiffNoBaseline": "Encara no hi ha res per comparar: aquesta sessió no ha desat cap punt de restauració aquí, i aquesta carpeta no és un repositori git.",
"CmdDiffFailed": "Ha fallat git diff — és un repositori git?\n{error}",
"CmdDiffNoChanges": "No hi ha canvis des de l’inici de la sessió",
"CmdDiffChangedFiles": "Fitxers modificats ({count}):\n{files}",
"CmdDiffChangedFilesRenamed": "Fitxers modificats ({count}, {renamed} amb el nom canviat):\n{files}",
"CmdDiffStatHeader": "Estadístiques",
"CmdDiffTruncated": "Les diferències són massa llargues per mostrar-les senceres. La llista de fitxers de dalt és completa.",
"CmdDiffTitle": "Canvis des de l’inici de la sessió",
"CmdEditDescription": "Revisa i torna a enviar l'últim missatge",
"CmdExitDescription": "Surt de l'aplicació",
"CmdExportDescription": "Copia una exportació segura de la conversació, o l'escriu a un fitxer explícit",
+9
View File
@@ -505,6 +505,15 @@
"CmdCostDescription": "Sitzungskosten-Aufschlüsselung anzeigen",
"CmdReceiptsDescription": "Anzeigen, was diese Sitzung getan hat: Dateien, Befehle, Freigaben",
"CmdDiffDescription": "Dateiänderungen seit Sitzungsbeginn anzeigen",
"CmdDiffGitUnavailable": "git wurde im PATH nicht gefunden",
"CmdDiffNoBaseline": "Noch nichts zum Vergleichen: Diese Sitzung hat hier noch keinen Wiederherstellungspunkt gespeichert, und dieser Ordner ist kein git-Repository.",
"CmdDiffFailed": "git diff fehlgeschlagen — ist dies ein git-Repository?\n{error}",
"CmdDiffNoChanges": "Keine Änderungen seit Sitzungsbeginn",
"CmdDiffChangedFiles": "Geänderte Dateien ({count}):\n{files}",
"CmdDiffChangedFilesRenamed": "Geänderte Dateien ({count}, davon {renamed} umbenannt):\n{files}",
"CmdDiffStatHeader": "Statistik",
"CmdDiffTruncated": "Die Unterschiede sind zu lang, um sie vollständig anzuzeigen. Die Dateiliste oben ist vollständig.",
"CmdDiffTitle": "Änderungen seit Sitzungsbeginn",
"CmdEditDescription": "Letzte Nachricht überarbeiten und erneut senden",
"CmdExitDescription": "Anwendung beenden",
"CmdExportDescription": "Sicheren Gesprächsexport kopieren oder in eine angegebene Datei schreiben",
+9
View File
@@ -508,6 +508,15 @@
"CmdCostDescription": "Show session cost breakdown",
"CmdReceiptsDescription": "Show what this session did: files, commands, approvals",
"CmdDiffDescription": "Show changes since this session started",
"CmdDiffGitUnavailable": "git not found on PATH",
"CmdDiffNoBaseline": "Nothing to compare yet: this session has not saved a restore point here, and this folder is not a git repository.",
"CmdDiffFailed": "Git diff failed — is this a git repository?\n{error}",
"CmdDiffNoChanges": "No changes since session start",
"CmdDiffChangedFiles": "Changed files ({count}):\n{files}",
"CmdDiffChangedFilesRenamed": "Changed files ({count}, {renamed} renamed):\n{files}",
"CmdDiffStatHeader": "Stat",
"CmdDiffTruncated": "The diff is too long to show in full. The file list above is complete.",
"CmdDiffTitle": "Changes since session start",
"CmdEditDescription": "Edit and resend your last message",
"CmdExitDescription": "Quit",
"CmdExportDescription": "Copy a safe export, or write it to a file",
+9
View File
@@ -508,6 +508,15 @@
"CmdCostDescription": "Mostrar el desglose de costo de la sesión",
"CmdReceiptsDescription": "Mostrar lo que hizo esta sesión: archivos, comandos, aprobaciones",
"CmdDiffDescription": "Mostrar cambios en archivos desde el inicio de la sesión",
"CmdDiffGitUnavailable": "No se encontró git en PATH",
"CmdDiffNoBaseline": "Todavía no hay nada que comparar: esta sesión no ha guardado un punto de restauración aquí y esta carpeta no es un repositorio git.",
"CmdDiffFailed": "Falló git diff — ¿es este un repositorio git?\n{error}",
"CmdDiffNoChanges": "Sin cambios desde el inicio de la sesión",
"CmdDiffChangedFiles": "Archivos modificados ({count}):\n{files}",
"CmdDiffChangedFilesRenamed": "Archivos modificados ({count}, {renamed} renombrados):\n{files}",
"CmdDiffStatHeader": "Estadísticas",
"CmdDiffTruncated": "Las diferencias son demasiado largas para mostrarlas completas. La lista de archivos de arriba está completa.",
"CmdDiffTitle": "Cambios desde el inicio de la sesión",
"CmdEditDescription": "Revisar y reenviar el último mensaje",
"CmdExitDescription": "Salir de la aplicación",
"CmdExportDescription": "Copiar una exportación segura de la conversación, o escribirla en un archivo explícito",
+9
View File
@@ -505,6 +505,15 @@
"CmdCostDescription": "Afficher le détail des coûts de la session",
"CmdReceiptsDescription": "Afficher ce que cette session a fait : fichiers, commandes, approbations",
"CmdDiffDescription": "Afficher les modifications de fichiers depuis le début de la session",
"CmdDiffGitUnavailable": "git est introuvable dans PATH",
"CmdDiffNoBaseline": "Rien à comparer pour le moment : cette session n’a enregistré aucun point de restauration ici et ce dossier n’est pas un dépôt git.",
"CmdDiffFailed": "Échec de git diff — est-ce un dépôt git ?\n{error}",
"CmdDiffNoChanges": "Aucune modification depuis le début de la session",
"CmdDiffChangedFiles": "Fichiers modifiés ({count}) :\n{files}",
"CmdDiffChangedFilesRenamed": "Fichiers modifiés ({count}, dont {renamed} renommés) :\n{files}",
"CmdDiffStatHeader": "Statistiques",
"CmdDiffTruncated": "Les différences sont trop longues pour être affichées en entier. La liste des fichiers ci-dessus est complète.",
"CmdDiffTitle": "Modifications depuis le début de la session",
"CmdEditDescription": "Réviser et renvoyer le dernier message",
"CmdExitDescription": "Quitter l'application",
"CmdExportDescription": "Copier un export sûr de la conversation, ou l'écrire dans un fichier explicite",
+9
View File
@@ -505,6 +505,15 @@
"CmdCostDescription": "सत्र लागत का विवरण दिखाएँ",
"CmdReceiptsDescription": "दिखाएँ कि इस सत्र ने क्या किया: फ़ाइलें, कमांड, स्वीकृतियाँ",
"CmdDiffDescription": "सत्र शुरू होने के बाद के फ़ाइल बदलाव दिखाएँ",
"CmdDiffGitUnavailable": "PATH में git नहीं मिला",
"CmdDiffNoBaseline": "अभी तुलना करने के लिए कुछ नहीं है: इस सत्र ने यहाँ कोई पुनर्स्थापना बिंदु नहीं सहेजा है और यह फ़ोल्डर git रिपॉज़िटरी नहीं है।",
"CmdDiffFailed": "git diff विफल हुआ — क्या यह git रिपॉज़िटरी है?\n{error}",
"CmdDiffNoChanges": "सत्र शुरू होने के बाद कोई बदलाव नहीं",
"CmdDiffChangedFiles": "बदली गई फ़ाइलें ({count}):\n{files}",
"CmdDiffChangedFilesRenamed": "बदली गई फ़ाइलें ({count}, {renamed} के नाम बदले गए):\n{files}",
"CmdDiffStatHeader": "आँकड़े",
"CmdDiffTruncated": "बदलाव इतने लंबे हैं कि उन्हें पूरा नहीं दिखाया जा सकता। ऊपर दी गई फ़ाइलों की सूची पूरी है।",
"CmdDiffTitle": "सत्र शुरू होने के बाद के बदलाव",
"CmdEditDescription": "अंतिम संदेश संशोधित कर पुनः सबमिट करें",
"CmdExitDescription": "एप्लिकेशन से बाहर निकलें",
"CmdExportDescription": "सुरक्षित वार्तालाप एक्सपोर्ट कॉपी करें, या किसी निर्दिष्ट फ़ाइल में लिखें",
+9
View File
@@ -505,6 +505,15 @@
"CmdCostDescription": "Tampilkan rincian biaya sesi",
"CmdReceiptsDescription": "Tampilkan apa yang dilakukan sesi ini: berkas, perintah, persetujuan",
"CmdDiffDescription": "Tampilkan perubahan file sejak awal sesi",
"CmdDiffGitUnavailable": "git tidak ditemukan di PATH",
"CmdDiffNoBaseline": "Belum ada yang bisa dibandingkan: sesi ini belum menyimpan titik pemulihan di sini, dan folder ini bukan repositori git.",
"CmdDiffFailed": "git diff gagal — apakah ini repositori git?\n{error}",
"CmdDiffNoChanges": "Tidak ada perubahan sejak awal sesi",
"CmdDiffChangedFiles": "Berkas yang berubah ({count}):\n{files}",
"CmdDiffChangedFilesRenamed": "Berkas yang berubah ({count}, {renamed} berganti nama):\n{files}",
"CmdDiffStatHeader": "Statistik",
"CmdDiffTruncated": "Perbedaan terlalu panjang untuk ditampilkan seluruhnya. Daftar berkas di atas sudah lengkap.",
"CmdDiffTitle": "Perubahan sejak awal sesi",
"CmdEditDescription": "Revisi dan kirim ulang pesan terakhir",
"CmdExitDescription": "Keluar dari aplikasi",
"CmdExportDescription": "Salin ekspor percakapan yang aman, atau tulis ke file tertentu",
+9
View File
@@ -508,6 +508,15 @@
"CmdCostDescription": "セッションのコスト内訳を表示",
"CmdReceiptsDescription": "このセッションの実行内容を表示: ファイル、コマンド、承認",
"CmdDiffDescription": "セッション開始以降のファイル変更を表示",
"CmdDiffGitUnavailable": "PATH に git が見つかりません",
"CmdDiffNoBaseline": "まだ比較できません: このセッションはここに復元ポイントを保存しておらず、このフォルダーは git リポジトリではありません。",
"CmdDiffFailed": "git diff に失敗しました — git リポジトリですか?\n{error}",
"CmdDiffNoChanges": "セッション開始以降の変更はありません",
"CmdDiffChangedFiles": "変更されたファイル({count} 件):\n{files}",
"CmdDiffChangedFilesRenamed": "変更されたファイル({count} 件、うち {renamed} 件を名前変更):\n{files}",
"CmdDiffStatHeader": "統計",
"CmdDiffTruncated": "差分が長すぎるため、全体を表示できません。上のファイル一覧はすべてのファイルを含んでいます。",
"CmdDiffTitle": "セッション開始以降の変更",
"CmdEditDescription": "最後のメッセージを編集して再送信",
"CmdExitDescription": "アプリを終了",
"CmdExportDescription": "会話を安全にエクスポートするか、明示したファイルへ書き出す",
+9
View File
@@ -508,6 +508,15 @@
"CmdCostDescription": "세션 비용 내역을 표시합니다",
"CmdReceiptsDescription": "이 세션이 한 일을 표시합니다: 파일, 명령, 승인",
"CmdDiffDescription": "세션 시작 이후 파일 변경 사항을 표시합니다",
"CmdDiffGitUnavailable": "PATH에서 git을 찾을 수 없습니다",
"CmdDiffNoBaseline": "아직 비교할 내용이 없습니다: 이 세션은 여기에 복원 지점을 저장하지 않았고, 이 폴더는 git 저장소가 아닙니다.",
"CmdDiffFailed": "git diff 실패 — git 저장소인가요?\n{error}",
"CmdDiffNoChanges": "세션 시작 이후 변경 사항이 없습니다",
"CmdDiffChangedFiles": "변경된 파일({count}개):\n{files}",
"CmdDiffChangedFilesRenamed": "변경된 파일({count}개, 이름 변경 {renamed}개):\n{files}",
"CmdDiffStatHeader": "통계",
"CmdDiffTruncated": "차이가 너무 길어 전체를 표시할 수 없습니다. 위의 파일 목록에는 모든 파일이 포함되어 있습니다.",
"CmdDiffTitle": "세션 시작 이후 변경 사항",
"CmdEditDescription": "마지막 메시지를 수정해서 다시 보냅니다",
"CmdExitDescription": "애플리케이션을 종료합니다",
"CmdExportDescription": "안전한 대화 내보내기를 복사하거나 지정한 파일에 씁니다",
+9
View File
@@ -508,6 +508,15 @@
"CmdCostDescription": "Exibir o detalhamento de custo da sessão",
"CmdReceiptsDescription": "Exibir o que esta sessão fez: arquivos, comandos, aprovações",
"CmdDiffDescription": "Mostrar alterações em arquivos desde o início da sessão",
"CmdDiffGitUnavailable": "git não encontrado no PATH",
"CmdDiffNoBaseline": "Ainda não há nada para comparar: esta sessão não salvou um ponto de restauração aqui, e esta pasta não é um repositório git.",
"CmdDiffFailed": "Falha no git diff — isto é um repositório git?\n{error}",
"CmdDiffNoChanges": "Nenhuma alteração desde o início da sessão",
"CmdDiffChangedFiles": "Arquivos alterados ({count}):\n{files}",
"CmdDiffChangedFilesRenamed": "Arquivos alterados ({count}, {renamed} renomeados):\n{files}",
"CmdDiffStatHeader": "Estatísticas",
"CmdDiffTruncated": "As diferenças são longas demais para serem exibidas por completo. A lista de arquivos acima está completa.",
"CmdDiffTitle": "Alterações desde o início da sessão",
"CmdEditDescription": "Revisar e reenviar a última mensagem",
"CmdExitDescription": "Sair do aplicativo",
"CmdExportDescription": "Copiar uma exportação segura da conversa, ou gravá-la em um arquivo explícito",
+9
View File
@@ -505,6 +505,15 @@
"CmdCostDescription": "Показать разбивку стоимости сессии",
"CmdReceiptsDescription": "Показать, что сделала эта сессия: файлы, команды, одобрения",
"CmdDiffDescription": "Показать изменения файлов с начала сессии",
"CmdDiffGitUnavailable": "git не найден в PATH",
"CmdDiffNoBaseline": "Пока нечего сравнивать: в этой сессии здесь ещё не сохранена точка восстановления, а эта папка не является репозиторием git.",
"CmdDiffFailed": "Сбой git diff — это репозиторий git?\n{error}",
"CmdDiffNoChanges": "Изменений с начала сессии нет",
"CmdDiffChangedFiles": "Изменённые файлы ({count}):\n{files}",
"CmdDiffChangedFilesRenamed": "Изменённые файлы ({count}, переименовано: {renamed}):\n{files}",
"CmdDiffStatHeader": "Статистика",
"CmdDiffTruncated": "Различия слишком велики, чтобы показать их полностью. Список файлов выше приведён целиком.",
"CmdDiffTitle": "Изменения с начала сессии",
"CmdEditDescription": "Изменить и повторно отправить последнее сообщение",
"CmdExitDescription": "Выйти из приложения",
"CmdExportDescription": "Скопировать безопасный экспорт диалога или записать его в указанный файл",
+9
View File
@@ -505,6 +505,15 @@
"CmdCostDescription": "Показати розбивку вартості сеансу",
"CmdReceiptsDescription": "Показати, що зробив цей сеанс: файли, команди, схвалення",
"CmdDiffDescription": "Показати зміни файлів від початку сеансу",
"CmdDiffGitUnavailable": "git не знайдено в PATH",
"CmdDiffNoBaseline": "Поки що немає чого порівнювати: цей сеанс ще не зберіг тут точки відновлення, а ця тека не є репозиторієм git.",
"CmdDiffFailed": "Помилка git diff — це репозиторій git?\n{error}",
"CmdDiffNoChanges": "Змін від початку сеансу немає",
"CmdDiffChangedFiles": "Змінені файли ({count}):\n{files}",
"CmdDiffChangedFilesRenamed": "Змінені файли ({count}, перейменовано: {renamed}):\n{files}",
"CmdDiffStatHeader": "Статистика",
"CmdDiffTruncated": "Відмінності задовгі, щоб показати їх повністю. Список файлів вище наведено повністю.",
"CmdDiffTitle": "Зміни від початку сеансу",
"CmdEditDescription": "Змінити й повторно надіслати останнє повідомлення",
"CmdExitDescription": "Вийти з застосунку",
"CmdExportDescription": "Скопіювати безпечний експорт розмови або записати його у вказаний файл",
+9
View File
@@ -508,6 +508,15 @@
"CmdCostDescription": "Hiển thị chi tiết chi phí của phiên làm việc",
"CmdReceiptsDescription": "Hiển thị những gì phiên làm việc này đã làm: tệp, lệnh, phê duyệt",
"CmdDiffDescription": "Hiển thị các thay đổi của tệp kể từ khi bắt đầu phiên",
"CmdDiffGitUnavailable": "Không tìm thấy git trong PATH",
"CmdDiffNoBaseline": "Chưa có gì để so sánh: phiên này chưa lưu điểm khôi phục nào ở đây và thư mục này không phải là kho git.",
"CmdDiffFailed": "git diff thất bại — đây có phải là kho git không?\n{error}",
"CmdDiffNoChanges": "Không có thay đổi kể từ khi bắt đầu phiên",
"CmdDiffChangedFiles": "Các tệp đã thay đổi ({count}):\n{files}",
"CmdDiffChangedFilesRenamed": "Các tệp đã thay đổi ({count}, {renamed} tệp được đổi tên):\n{files}",
"CmdDiffStatHeader": "Thống kê",
"CmdDiffTruncated": "Phần khác biệt quá dài để hiển thị đầy đủ. Danh sách tệp ở trên đã đầy đủ.",
"CmdDiffTitle": "Các thay đổi kể từ khi bắt đầu phiên",
"CmdEditDescription": "Chỉnh sửa và gửi lại tin nhắn gần nhất",
"CmdExitDescription": "Thoát ứng dụng",
"CmdExportDescription": "Sao chép bản xuất cuộc trò chuyện an toàn, hoặc ghi vào một tệp chỉ định",
+9
View File
@@ -508,6 +508,15 @@
"CmdCostDescription": "显示本次会话的费用明细",
"CmdReceiptsDescription": "显示本次会话做了什么:文件、命令、审批",
"CmdDiffDescription": "显示会话开始以来的文件变更",
"CmdDiffGitUnavailable": "在 PATH 中找不到 git",
"CmdDiffNoBaseline": "暂无可比较的内容:此会话尚未在这里保存还原点,且此文件夹不是 git 仓库。",
"CmdDiffFailed": "Git 差异比较失败——这是一个 git 仓库吗?\n{error}",
"CmdDiffNoChanges": "会话开始以来没有变更",
"CmdDiffChangedFiles": "变更文件({count} 个):\n{files}",
"CmdDiffChangedFilesRenamed": "变更文件({count} 个,其中 {renamed} 个已重命名):\n{files}",
"CmdDiffStatHeader": "统计",
"CmdDiffTruncated": "差异内容过长,无法完整显示。上方的文件列表是完整的。",
"CmdDiffTitle": "会话开始以来的变更",
"CmdEditDescription": "修改并重新提交最后一条消息",
"CmdExitDescription": "退出应用",
"CmdExportDescription": "将对话安全地复制导出,或写入到指定文件",
+9
View File
@@ -506,6 +506,15 @@
"CmdCostDescription": "顯示本工作階段的費用明細",
"CmdReceiptsDescription": "顯示本工作階段做了什麼:檔案、指令、核准",
"CmdDiffDescription": "顯示工作階段開始以來的檔案變更",
"CmdDiffGitUnavailable": "在 PATH 中找不到 git",
"CmdDiffNoBaseline": "尚無可比較的內容:此工作階段尚未在這裡儲存還原點,且此資料夾不是 git 儲存庫。",
"CmdDiffFailed": "Git 差異比較失敗——這是 git 儲存庫嗎?\n{error}",
"CmdDiffNoChanges": "工作階段開始以來沒有變更",
"CmdDiffChangedFiles": "變更檔案({count} 個):\n{files}",
"CmdDiffChangedFilesRenamed": "變更檔案({count} 個,其中 {renamed} 個已重新命名):\n{files}",
"CmdDiffStatHeader": "統計",
"CmdDiffTruncated": "差異內容過長,無法完整顯示。上方的檔案清單是完整的。",
"CmdDiffTitle": "工作階段開始以來的變更",
"CmdEditDescription": "修改並重新提交最後一條訊息",
"CmdExitDescription": "退出套用",
"CmdExportDescription": "將對話安全地複製匯出,或寫入到指定檔案",
+18
View File
@@ -531,6 +531,15 @@ pub enum MessageId {
CmdCostDescription,
CmdReceiptsDescription,
CmdDiffDescription,
CmdDiffGitUnavailable,
CmdDiffNoBaseline,
CmdDiffFailed,
CmdDiffNoChanges,
CmdDiffChangedFiles,
CmdDiffChangedFilesRenamed,
CmdDiffStatHeader,
CmdDiffTruncated,
CmdDiffTitle,
CmdEditDescription,
CmdExitDescription,
CmdExportDescription,
@@ -3278,6 +3287,15 @@ pub const ALL_MESSAGE_IDS: &[MessageId] = &[
MessageId::CmdCostDescription,
MessageId::CmdReceiptsDescription,
MessageId::CmdDiffDescription,
MessageId::CmdDiffGitUnavailable,
MessageId::CmdDiffNoBaseline,
MessageId::CmdDiffFailed,
MessageId::CmdDiffNoChanges,
MessageId::CmdDiffChangedFiles,
MessageId::CmdDiffChangedFilesRenamed,
MessageId::CmdDiffStatHeader,
MessageId::CmdDiffTruncated,
MessageId::CmdDiffTitle,
MessageId::CmdEditDescription,
MessageId::CmdExitDescription,
MessageId::CmdExportDescription,
@@ -8,6 +8,15 @@ pub(super) fn resolve(key: &str) -> Option<MessageId> {
return Some(crate::pricing::UnpricedReason::from_label(reason).message_id());
}
Some(match key {
"cmd_diff_git_unavailable" => MessageId::CmdDiffGitUnavailable,
"cmd_diff_no_baseline" => MessageId::CmdDiffNoBaseline,
"cmd_diff_failed" => MessageId::CmdDiffFailed,
"cmd_diff_no_changes" => MessageId::CmdDiffNoChanges,
"cmd_diff_changed_files" => MessageId::CmdDiffChangedFiles,
"cmd_diff_changed_files_renamed" => MessageId::CmdDiffChangedFilesRenamed,
"cmd_diff_stat_header" => MessageId::CmdDiffStatHeader,
"cmd_diff_truncated" => MessageId::CmdDiffTruncated,
"cmd_diff_title" => MessageId::CmdDiffTitle,
"cmd_change_header" => MessageId::CmdChangeHeader,
"cmd_change_previous_version" => MessageId::CmdChangePreviousVersion,
"cmd_change_translation_unavailable" => MessageId::CmdChangeTranslationUnavailable,