//#region src/i18n/translations-en.d.ts /** * The canonical English UI-string dictionary for pptx-viewer. None of the * React/Vue/Angular binding packages ship translations themselves - each * only calls its framework's translation function (react-i18next's `t()`, * vue-i18n's `t()`, ngx-translate's `TranslateService`/`translate` pipe) * against dotted `pptx.*` keys. The host app supplies the dictionary; this * module is that dictionary for the demos, shared so all three stay in sync * instead of drifting into three separate copies. */ declare const translationsEn: Record; /** * Every key in the English dictionary. A new locale dictionary typed as * `Record` gets a compile error for any key it's * missing or misspells, so translation contributions stay complete without a * separate parity test. */ type TranslationKey = keyof typeof translationsEn; /** * Convert a dotted translation key to a human-readable label when no * explicit dictionary entry exists yet. Takes the last segment and converts * camelCase to Title Case, e.g. "pptx.slideSorter.zoomIn" -> "Zoom In". */ declare function keyToLabel(key: string): string; //#endregion //#region src/i18n/locale-catalog.d.ts /** One selectable entry in the viewer chrome's built-in language picker (File > Options > Language). */ interface LocaleCatalogEntry { /** BCP-47-ish locale code, e.g. `'en'`, `'fr'`. Matches `pptx-viewer-locales`' exports. */ code: string; /** English display name, used before a translation dictionary for the target locale is loaded. */ label: string; /** The locale's own name for itself, e.g. `'Français'` for `fr`. */ nativeLabel: string; } /** * Built-in language choices offered by File > Options > Language when a host * doesn't supply its own `availableLocales`. Mirrors the locales shipped by * the optional `pptx-viewer-locales` package (English needs no dictionary, * it's the viewer's own baseline). */ declare const LOCALE_CATALOG: readonly LocaleCatalogEntry[]; /** * Minimal, dependency-free translation layer for the Svelte binding. * * The canonical English dictionary lives in `pptx-viewer-shared/i18n` (shared * with the React, Vue, and Angular bindings, which each plug it into their * framework's i18n library). Svelte has no blessed i18n runtime, so this * module implements the small subset the viewer needs: dictionary lookup by * locale with English fallback, `{{name}}` interpolation, and the shared * `keyToLabel` humanised fallback for missing keys. */ /** A flat dictionary of dotted `pptx.*` keys to display strings. */ type TranslationDictionary = Record; /** Translate `key`, interpolating `{{name}}` placeholders from `params`. */ type Translator = (key: string, params?: Record) => string; /** * Register (or extend) the dictionary for a locale. Later registrations are * merged over earlier ones, so hosts can override individual keys. */ declare function registerTranslations(locale: string, dictionary: TranslationDictionary): void; /** * List every locale code with a registered dictionary: `en` (built in) plus * anything added via {@link registerTranslations}. Used by File > Options' * Language tab to offer only locales the host has actually wired up. */ declare function getRegisteredLocales(): string[]; /** Interpolate `{{name}}` placeholders (the shared-dictionary convention). */ declare function interpolate(message: string, params: Record | undefined): string; /** * Translate a key for a locale: exact locale dictionary, then its base * language (`fr-CA` falls back to `fr`), then English, then the humanised * `keyToLabel` fallback so missing keys never render as raw dotted paths. */ declare function translate(locale: string, key: string, params?: Record): string; /** Build a {@link Translator} bound to a (lazily-read) locale. */ declare function createTranslator(getLocale: () => string): Translator; export { LOCALE_CATALOG, createTranslator, getRegisteredLocales, interpolate, keyToLabel, registerTranslations, translate, translationsEn }; export type { LocaleCatalogEntry, TranslationDictionary, TranslationKey, Translator };