previewPaneI18n.test.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { describe, expect, it } from "vitest";
  2. import enUS from "@/i18n/locales/en-US.js";
  3. import zhCN from "@/i18n/locales/zh-CN.js";
  4. describe("PreviewPane i18n", () => {
  5. it("未选择编辑器时中文提示已翻译且英文保持不变", () => {
  6. expect(zhCN["chat.changeSummary.openInEditor"]).toBe("在编辑器中打开");
  7. expect(enUS["chat.changeSummary.openInEditor"]).toBe("Open in editor");
  8. });
  9. it("绝对路径和相对路径复制入口具备成对翻译", () => {
  10. expect(zhCN["fileActions.copyAbsolutePath"]).toBe("复制绝对路径");
  11. expect(enUS["fileActions.copyAbsolutePath"]).toBe("Copy absolute path");
  12. expect(zhCN["fileActions.copyRelativePath"]).toBe("复制相对路径");
  13. expect(enUS["fileActions.copyRelativePath"]).toBe("Copy relative path");
  14. });
  15. it("provides localized PPTX preview controls and errors", () => {
  16. expect(enUS["codeViewer.pptx.previousPage"]).toBe("Previous slide");
  17. expect(enUS["codeViewer.pptx.fileTooLarge"]).toContain("64 MB");
  18. expect(enUS["codeViewer.pptx.legacyFileTooLarge"]).toContain("8 MB");
  19. expect(enUS["codeViewer.pptx.incomplete"]).toContain("truncated");
  20. expect(zhCN["codeViewer.pptx.previousPage"]).toBe("上一张幻灯片");
  21. expect(zhCN["codeViewer.pptx.fileTooLarge"]).toContain("64 MB");
  22. expect(zhCN["codeViewer.pptx.legacyFileTooLarge"]).toContain("8 MB");
  23. expect(zhCN["codeViewer.pptx.incomplete"]).toContain("截断");
  24. expect(enUS["codeViewer.pptx.aiEdit"]).toBe("AI Edit");
  25. expect(zhCN["codeViewer.pptx.aiEdit"]).toBe("AI 编辑");
  26. expect(enUS["codeViewer.pptx.commentPlaceholder"]).toContain("comment");
  27. expect(zhCN["codeViewer.pptx.commentPlaceholder"]).toContain("评论");
  28. expect(enUS["codeViewer.pptx.cancelAiEdit"]).toBe("Cancel");
  29. expect(zhCN["codeViewer.pptx.cancelAiEdit"]).toBe("取消");
  30. expect(enUS["codeViewer.pptx.addToConversation"]).toBe("Add to conversation");
  31. expect(zhCN["codeViewer.pptx.addToConversation"]).toBe("添加到对话");
  32. });
  33. it("provides paired translations for PPTX export-as-PDF actions", () => {
  34. expect(enUS["codeViewer.pptx.exportPdf"]).toBe("Export as PDF");
  35. expect(zhCN["codeViewer.pptx.exportPdf"]).toBe("导出为 PDF");
  36. expect(enUS["codeViewer.pptx.exportingPdf"]).toBe("Exporting PDF...");
  37. expect(zhCN["codeViewer.pptx.exportingPdf"]).toBe("正在导出 PDF...");
  38. expect(enUS["codeViewer.pptx.exportPdfSuccess"]).toContain("{path}");
  39. expect(zhCN["codeViewer.pptx.exportPdfSuccess"]).toContain("{path}");
  40. expect(enUS["codeViewer.pptx.exportPdfFailed"]).toBe("Failed to export PDF");
  41. expect(zhCN["codeViewer.pptx.exportPdfFailed"]).toBe("PDF 导出失败");
  42. });
  43. it("localizes the bounded text preview message", () => {
  44. expect(enUS["codeViewer.fileTooLarge"]).toContain("256 KB");
  45. expect(enUS["codeViewer.fileTooLarge"]).toContain("another editor");
  46. expect(zhCN["codeViewer.fileTooLarge"]).toContain("256 KB");
  47. expect(zhCN["codeViewer.fileTooLarge"]).toContain("其他编辑器");
  48. });
  49. });