initI18n (src/lib/i18n/index.ts) registers three locales and picks the
initial one in order: kon_locale in localStorage > navigator.language short
code > en. +layout.svelte calls it once at app boot; guarded so per-window
re-init is a no-op.
Locale files are deliberately sparse — this is a scaffolding pass so strings
can be migrated incrementally. The Settings → Appearance → Language picker
plus its own description is the first real consumer; everything else
continues to render as hardcoded text until extracted.
Also: split the @chenglou/pretext ambient shim into src/lib/shims.d.ts. The
declaration previously lived in app.d.ts alongside a top-level `export {}`,
which made app.d.ts a module — scoping `declare module` to its own imports
and breaking resolution from src/lib/utils/textMeasure.ts. The fresh
.svelte-kit sync triggered by installing svelte-i18n surfaced it. Ambient
shim files must stay script-scoped (no top-level imports/exports).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
40 lines
935 B
TypeScript
40 lines
935 B
TypeScript
// Ambient module shims. Must stay script-scoped (no top-level imports /
|
|
// exports) so `declare module` registers globally; adding an import/export
|
|
// turns the file into a module and scopes the declaration away.
|
|
|
|
declare module "@chenglou/pretext" {
|
|
export interface PretextLayoutLine {
|
|
text: string;
|
|
}
|
|
|
|
export interface PretextLayoutResult {
|
|
height: number;
|
|
lineCount: number;
|
|
lines: PretextLayoutLine[];
|
|
}
|
|
|
|
export function prepare(
|
|
text: string,
|
|
font: string,
|
|
options?: Record<string, unknown>,
|
|
): unknown;
|
|
|
|
export function prepareWithSegments(
|
|
text: string,
|
|
font: string,
|
|
options?: Record<string, unknown>,
|
|
): unknown;
|
|
|
|
export function layout(
|
|
prepared: unknown,
|
|
maxWidth: number,
|
|
lineHeight: number,
|
|
): PretextLayoutResult;
|
|
|
|
export function layoutWithLines(
|
|
prepared: unknown,
|
|
maxWidth: number,
|
|
lineHeight: number,
|
|
): PretextLayoutResult;
|
|
}
|