mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
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.
23 lines
878 B
TypeScript
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();
|
|
});
|
|
});
|