mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
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.
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
// scripts/i18n/lib/glossary.mjs
|
||||
import { SUPPORTED_LOCALES } from "../../../packages/shared/src/i18n/index.ts";
|
||||
|
||||
/** Terms that must stay verbatim in every language. */
|
||||
export const DO_NOT_TRANSLATE = [
|
||||
"SnapOtter",
|
||||
"API",
|
||||
"REST",
|
||||
"JSON",
|
||||
"YAML",
|
||||
"URL",
|
||||
"HTTP",
|
||||
"JPEG",
|
||||
"PNG",
|
||||
"WebP",
|
||||
"AVIF",
|
||||
"HEIC",
|
||||
"GIF",
|
||||
"SVG",
|
||||
"EXIF",
|
||||
"PDF",
|
||||
"FFmpeg",
|
||||
"Docker",
|
||||
"Compose",
|
||||
"Postgres",
|
||||
"Redis",
|
||||
"OIDC",
|
||||
"SSO",
|
||||
"SAML",
|
||||
"SCIM",
|
||||
];
|
||||
|
||||
/**
|
||||
* @param {string} locale
|
||||
* @returns {string} the English display name of the locale
|
||||
*/
|
||||
function localeName(locale) {
|
||||
const entry = SUPPORTED_LOCALES.find((l) => l.code === locale);
|
||||
if (!entry) throw new Error(`Unknown locale: ${locale}`);
|
||||
return entry.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* System prompt for translating one batch into `locale`.
|
||||
* @param {string} locale
|
||||
* @returns {string}
|
||||
*/
|
||||
export function buildSystemPrompt(locale) {
|
||||
const name = localeName(locale);
|
||||
return [
|
||||
`You are a professional software-localization translator. Translate the user's content into ${name}.`,
|
||||
"",
|
||||
"Rules:",
|
||||
`- Translate prose only. Preserve all markdown structure, whitespace, and line breaks exactly.`,
|
||||
`- Never translate, reorder, or remove any ⸤I18N…⸥ marker. Copy each one verbatim in place.`,
|
||||
`- Do not translate these terms; keep them exactly as written: ${DO_NOT_TRANSLATE.join(", ")}.`,
|
||||
`- Keep code, URLs, file paths, and CLI flags unchanged.`,
|
||||
`- Preserve the meaning and tone. Do not add notes, explanations, or extra text.`,
|
||||
`- Output only the translation. No preamble, no closing remarks.`,
|
||||
].join("\n");
|
||||
}
|
||||
Reference in New Issue
Block a user