UNPKG

@gulibs/react-vintl

Version:

Type-safe i18n library for React with Vite plugin and automatic type inference

60 lines (50 loc) 1.43 kB
declare module '@gulibs/react-vintl-locales' { /** * 翻译资源对象(运行时从虚拟模块导入) */ export const resources: Record<string, Record<string, any>>; /** * 支持的语言列表 */ export const supportedLocales: readonly string[]; /** * 插件配置信息 */ export const config: { readonly supportedLocales: readonly string[]; readonly basePath: string; readonly localePattern: 'directory' | 'filename'; }; /** * 所有翻译键的数组(用于运行时验证) */ export const keys: readonly string[]; /** * 翻译资源的类型(自动从虚拟模块推导) */ export type I18nResources = typeof resources; /** * 支持的语言类型 */ export type I18nLocales = typeof supportedLocales[number]; /** * 翻译键的联合类型(由插件自动生成) * 提供完美的 IDE 自动补全支持 * * ⚠️ 此类型在开发时由插件自动更新,请勿手动修改 */ export type I18nKeys = | string; /** * 命名空间的联合类型(由插件自动生成) * 提供完美的 IDE 自动补全支持 * * ⚠️ 此类型在开发时由插件自动更新,请勿手动修改 */ export type I18nNamespaces = | string; export default resources; } declare module '@gulibs/react-vintl/react-vintl-locales' { export * from '@gulibs/react-vintl-locales'; }