export type Locale = "zh-CN" | "en" | string; export interface I18nMessages { [key: string]: string; } /** A custom message can either apply to every locale or supply per-locale text. */ export type LocalizedMessage = string | Record; /** * Customer overrides for static SDK UI copy. * * Existing `Record` values remain valid. A locale map lets one * SiteConfig travel across locales without regenerating its messages object. */ export interface I18nMessageOverrides { [key: string]: LocalizedMessage; } /** * 读取浏览器语言并归一化为内置 locale。 * en* -> "en",zh* -> "zh-CN",其余回退 "zh-CN"。 */ export declare function detectBrowserLocale(): Locale; /** * 记录数据驱动文案(分类/属性/属性值/推荐类型)在当前语言缺少 alias 的情况。 * 由 site-config 的 resolveDataLabel 在回退到接口 name/code 时调用。 */ export declare function recordMissingDataLabel(locale: string, kind: string, key: string | undefined | null): void; /** 开关:是否在控制台输出缺失文案告警(默认关闭,开发模式由 initSDK 自动开启)。 */ export declare function setMissingTranslationWarning(enabled: boolean): void; export interface MissingTranslationsReport { locale: string; /** 未找到内置/自定义译文、最终回退到 key 的 UI 文案 key。 */ messageKeys: string[]; /** 未配置 alias、回退到接口 name/code 的数据项(按 kind 分组)。 */ dataLabels: { kind: string; key: string; }[]; } /** 返回指定语言(默认当前语言)下检测到的缺失文案。 */ export declare function getMissingTranslations(locale?: string): MissingTranslationsReport; /** 清空缺失文案记录;不传 locale 时清空全部语言。 */ export declare function resetMissingTranslations(locale?: string): void; export declare function setLocale(locale: Locale): void; export declare function getLocale(): Locale; export declare function setMessages(messages: I18nMessageOverrides): void; export declare function t(key: string, params?: Record): string; export declare function createTranslator(locale?: string, messages?: I18nMessageOverrides): (key: string, params?: Record) => string;