import { type ReactElement, type ReactNode } from 'react'; import { type LocaleKey } from './locales.ts'; /** * Locales this plugin ships copy for: DSH's two built-in locales — Simplified * Chinese (`zh`, the host's own id) and English (`en`). The plugin keeps the * host's language catalog untouched on purpose: language selection stays a DSH * setting, and contributing a plugin-private third language would leave the * host UI and this dashboard speaking different languages, because no other * package ships a dictionary for it. */ export type LocaleId = 'zh' | 'en'; /** * Resolve the `Intl` tag for a plugin locale. * @param locale - active plugin locale. * @returns the BCP 47 tag to pass to `Intl.*` / `toLocaleString`. */ export declare function intlLocale(locale: LocaleId): string; export type Translate = (key: LocaleKey, params?: Record) => string; export declare const fallbackT: Translate; export declare function LocaleProvider(props: { t: Translate; children: ReactNode; }): ReactElement; /** * Read the translate function plus the concrete locale it is bound to. The * identity rides the dictionary itself (`meta.locale`), because slot components * receive only the `t` seat, not the host's locale snapshot; every dictionary * stores its own id there, so a language switch moves both together. * @returns the active `t` and the plugin locale it resolves to. */ export declare function useI18n(): { t: Translate; locale: LocaleId; }; /** Translate host error copy that predates stable machine-readable error codes. */ export declare function localizeApiError(message: string | undefined, t: Translate, fallback: LocaleKey): string;