/** * @fabric-msft/localization * * Provides type-safe, lazy-loaded localized strings for Fabric UX components. * * @example * ```typescript * import { loadStrings, getString, formatString } from '@fabric-msft/localization'; * * // Load strings at app startup * await loadStrings('es'); * * // Simple string lookup * const label = getString('SearchBox_Clear'); * * // With placeholder interpolation * const status = formatString('Pagination_Status', 5, 100); * // "Showing 5 of 100 items" (if string is "Showing {0} of {1} items") * ``` */ export type { LocaleStringKey } from "./types.js"; import type { LocaleStringKey } from "./types.js"; import { availableLocales, type AvailableLocales } from "./locales/index.js"; export { availableLocales }; export type { AvailableLocales }; /** * Load localized strings for a specific locale. * Dynamically imports only the requested locale's strings. * * @param locale - The locale code (e.g., 'en', 'es', 'zh-Hans') * @throws Error if the locale is not available * * @example * ```typescript * await loadStrings('es'); * await loadStrings('zh-Hans'); * ``` */ export declare function loadStrings(locale: AvailableLocales): Promise; /** * Synchronously set the active localized strings without a dynamic import. * * Use this in environments that cannot execute the dynamic `import()` that * {@link loadStrings} relies on — for example SystemJS-based sandboxes such * as StackBlitz's `create-react-app` template. Pass a statically-imported * locale record from `@fabric-msft/localization/locales/`. * * @param locale - The locale code these strings correspond to. * @param strings - The full record of localized strings for the locale. * * @example * ```typescript * import { strings } from '@fabric-msft/localization/locales/en'; * import { setStrings } from '@fabric-msft/localization'; * * setStrings('en', strings); * ``` */ export declare function setStrings(locale: AvailableLocales, strings: Record): void; /** * Get the currently loaded locale code. * * @returns The loaded locale code, or null if no strings are loaded */ export declare function getLoadedLocale(): AvailableLocales | null; /** * Get a localized string by key. * * @param key - The string key (type-checked against available keys) * @returns The localized string, or the key itself if not found * @throws Error if strings have not been loaded * * @example * ```typescript * const label = getString('SearchBox_Clear'); * ``` */ export declare function getString(key: LocaleStringKey): string; /** * Get a localized string and replace positional placeholders. * Placeholders use the format {0}, {1}, {2}, etc. * * @param key - The string key (type-checked against available keys) * @param args - Values to substitute for {0}, {1}, etc. * @returns The formatted string * @throws Error if strings have not been loaded * * @example * ```typescript * // If the string is "Showing {0} of {1} items" * const status = formatString('Pagination_Status', 5, 100); * // Returns: "Showing 5 of 100 items" * ``` */ export declare function formatString(key: LocaleStringKey, ...args: (string | number)[]): string; export declare function formatString(key: LocaleStringKey, args: Record): string; export declare function formatStringTemplate(template: string, values: Record): string; export declare function overrideLocaleLoader(locale: AvailableLocales, loader: () => Promise): void; export declare function overrideLocaleLoaders(loaders: Record Promise>): void; //# sourceMappingURL=index.d.ts.map