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.
19 lines
652 B
TypeScript
19 lines
652 B
TypeScript
// tests/unit/scripts/i18n/fake-adapter.ts
|
|
// In-memory adapter matching the contract in scripts/i18n/adapter-contract.md.
|
|
export function makeFakeAdapter(units: Array<{ id: string; sourceText: string; kind?: string }>) {
|
|
const store = new Map<string, Map<string, any>>(); // locale -> (id -> entry)
|
|
return {
|
|
name: "fake",
|
|
async extract() {
|
|
return units.map((u) => ({ kind: "markdown", ...u }));
|
|
},
|
|
async load(locale: string) {
|
|
return new Map(store.get(locale) ?? new Map());
|
|
},
|
|
async write(locale: string, entries: Map<string, any>) {
|
|
store.set(locale, new Map(entries));
|
|
},
|
|
_store: store,
|
|
};
|
|
}
|