UNPKG

@gulibs/react-vintl

Version:

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

29 lines 1.03 kB
import type { I18nResources, TranslationFunction } from './types'; /** * 从嵌套对象中获取值 */ export declare function getNestedValue(obj: unknown, path: string): unknown; /** * 高级参数插值系统 * 支持多种插值格式: * - {{key}} - 简单插值 * - {{key, format}} - 带格式的插值 * - {{key, plural, one=1 item, other=# items}} - 复数形式 * - {{key, select, male=He, female=She, other=They}} - 选择形式 * - {{key, number}} - 数字格式化 * - {{key, date}} - 日期格式化 */ export declare function replaceParams(text: string, params?: Record<string, unknown>): string; /** * 验证参数对象 */ export declare function validateParams(params: Record<string, unknown>): boolean; /** * 创建翻译函数 */ export declare function createTranslationFunction<T extends I18nResources>(resources: T, locale: string): TranslationFunction; /** * 验证资源结构 */ export declare function validateResources(resources: I18nResources): boolean; //# sourceMappingURL=utils.d.ts.map