40 lines
1.6 KiB
Plaintext
40 lines
1.6 KiB
Plaintext
import type { FormatXMLElementFn, Formats } from 'intl-messageformat';
|
|
export interface LocaleDictionary {
|
|
[key: string]: LocaleDictionary | string | Array<string | LocaleDictionary>;
|
|
}
|
|
export declare type LocalesDictionary = {
|
|
[key: string]: LocaleDictionary;
|
|
};
|
|
export declare type InterpolationValues = Record<string, string | number | boolean | Date | FormatXMLElementFn<unknown> | null | undefined> | undefined;
|
|
export interface MessageObject {
|
|
id?: string;
|
|
locale?: string;
|
|
format?: string;
|
|
default?: string;
|
|
values?: InterpolationValues;
|
|
}
|
|
export declare type MessageFormatter = (id: string | MessageObject, options?: MessageObject) => string;
|
|
export declare type TimeFormatter = (d: Date | number, options?: IntlFormatterOptions<Intl.DateTimeFormatOptions>) => string;
|
|
export declare type DateFormatter = (d: Date | number, options?: IntlFormatterOptions<Intl.DateTimeFormatOptions>) => string;
|
|
export declare type NumberFormatter = (d: number, options?: IntlFormatterOptions<Intl.NumberFormatOptions>) => string;
|
|
export declare type JSONGetter = <T>(id: string, locale?: string) => T;
|
|
declare type IntlFormatterOptions<T> = T & {
|
|
format?: string;
|
|
locale?: string;
|
|
};
|
|
export interface MemoizedIntlFormatter<T, U> {
|
|
(options?: IntlFormatterOptions<U>): T;
|
|
}
|
|
export interface MessagesLoader {
|
|
(): Promise<any>;
|
|
}
|
|
export interface ConfigureOptions {
|
|
fallbackLocale: string;
|
|
formats?: Partial<Formats>;
|
|
initialLocale?: string;
|
|
loadingDelay?: number;
|
|
warnOnMissingMessages?: boolean;
|
|
ignoreTag?: boolean;
|
|
}
|
|
export {};
|