UNPKG

@alauda-fe/common

Version:

Alauda frontend team common codes.

37 lines (36 loc) 1.07 kB
/** * @packageDocumentation * @module translate */ import { Arrayable } from '../core/public-api'; export type TranslationValue = Arrayable<string | number | boolean | Translation>; export interface Translation { [key: string]: TranslationValue; } export type Translations = Record<string, Translation>; export type TranslateKey = string | Translation; /** * 模板插值数据类型 * 参考主流 i18n 库的类型定义 */ export type TemplateData = string | number | boolean | Date | null | undefined | TemplateDataObject | TemplateData[] | unknown; export interface TemplateDataObject { [key: string]: TemplateData; } /** * ICU 兼容的简化数据类型 * ICU MessageFormat 原生支持的数据类型 */ export type IcuValue = string | number | Date; export interface IcuData { [key: string]: IcuValue; } export interface TranslateOptions { locale?: string; fallbackLocale?: string; locales?: string[]; translations?: Translations; loose?: boolean; remoteTranslations?: Translations; remoteUrl?: string | string[]; }