@pptx-editor.dev/i18n

v0.3.1 · 4 published subpaths with full TypeScript signatures and JSDoc.

Subpaths

Package root

@pptx-editor.dev/i18n — the chrome's user-facing strings.

en.json is the source of truth. A locale catalog mirrors its shape; a null leaf falls back to English. Keys are dotted paths (toolbar.bold). Parameters use {name}.

Mirrors docx-editor/packages/i18n: one catalog, typed keys, no hardcoded English in chrome. DOCX Editor commit adf0e178.

Functions (2)

createTranslatorfunctionSource ↗

Create a translator over an optional locale catalog. Missing or null entries fall back to English; an unknown key returns the key itself, so a gap is visible instead of blank.

declare function createTranslator(locale?: LocaleCatalog): Translate;

isTranslationKeyfunctionSource ↗

Whether a string is a key of the English catalog. Engine refusal reasons and other keys that arrive as plain strings pass through this guard before they reach a Translate, so no caller casts a string to TranslationKey.

declare function isTranslationKey(key: string): key is TranslationKey;

Interfaces (1)

LocaleCataloginterfaceSource ↗

A locale catalog: the English shape, where null means "fall back to English".

interface LocaleCatalog extends DeepNullable<Catalog>

Type aliases (4)

CatalogtypeSource ↗

The English catalog, the shape every locale mirrors.

type Catalog = typeof export_default;

TranslatetypeSource ↗

A function that turns a key into display text.

type Translate = (key: TranslationKey, params?: TranslationParams) => string;

TranslationKeytypeSource ↗

Every translation key, derived from en.json.

type TranslationKey = Leaves<Catalog>;

TranslationParamstypeSource ↗

Values substituted into {name} placeholders.

type TranslationParams = Readonly<Record<string, string | number>>;

Variables (1)

englishCatalogconstSource ↗

The English catalog.

englishCatalog: Catalog