Files
SnapOtter/tests/unit/scripts/i18n/glossary.test.ts
T
SnapOtterandGitHub 00b651c9f8 feat(i18n): 21-language pipeline, landing/docs/API wiring, landing+API translations
Shared Claude Code translation pipeline (scripts/i18n, no API key) plus Astro/VitePress/Scalar i18n wiring. Landing and API reference translated into all 20 languages; docs i18n wiring + English source anchors. The translated docs markdown (apps/docs/<locale>/**, 3,620 files) follows in a companion PR because it exceeds GitHub's per-PR CI file limit.
2026-07-11 13:01:55 +08:00

23 lines
878 B
TypeScript

// tests/unit/scripts/i18n/glossary.test.ts
import { describe, expect, it } from "vitest";
import { buildSystemPrompt, DO_NOT_TRANSLATE } from "../../../../scripts/i18n/lib/glossary.mjs";
describe("glossary", () => {
it("keeps the product name and format terms untranslated", () => {
expect(DO_NOT_TRANSLATE).toContain("SnapOtter");
expect(DO_NOT_TRANSLATE).toContain("WebP");
});
it("builds a system prompt naming the target language and the rules", () => {
const prompt = buildSystemPrompt("de");
expect(prompt).toContain("German");
expect(prompt).toContain("SnapOtter");
expect(prompt).toMatch(/do not translate|keep.*unchanged/i);
expect(prompt).toMatch(/⸤I18N/); // must warn about the token markers
});
it("throws on an unknown locale so typos fail loudly", () => {
expect(() => buildSystemPrompt("xx")).toThrow();
});
});