UNPKG

macoolka-i18n

Version:

`macoolka-i18n` is a library for internationalization in TypeScript. It easily integrates some localization features to your Application.

52 lines (51 loc) 1.99 kB
import IntlRelativeTimeFormat from '@formatjs/intl-relativetimeformat'; export { IntlRelativeTimeFormat, IntlMessageFormat }; import IntlMessageFormat, { Formats as MessageFormats } from 'intl-messageformat'; export { MessageFormats }; export declare type FormatDateTimeOptions = Intl.DateTimeFormatOptions & { locale?: string; }; export declare type FormatDateTimeValue = Parameters<Intl.DateTimeFormat['format']>[0]; export interface FormatDatetime { (option: FormatDateTimeOptions): (value: FormatDateTimeValue) => string; } export declare type FormatNumberOptions = Intl.NumberFormatOptions & { locale?: string; }; export declare type FormatNumberValue = Parameters<Intl.NumberFormat['format']>[0]; export interface FormatNumber { (option: FormatNumberOptions): (value: FormatNumberValue) => string; } export declare type FormatPluralOptions = Intl.PluralRulesOptions & { locale?: string; }; export declare type FormatPluralValue = Parameters<Intl.PluralRules['select']>[0]; export interface FormatPlural { (option: FormatPluralOptions): (value: FormatPluralValue) => string; } export declare type FormatRelativeTimeOptions = any & { unit?: any; locale: string; }; export declare type FormatRelativeTimeValue = Parameters<IntlRelativeTimeFormat['format']>[0]; export interface FormatRelativeTime { (option: FormatRelativeTimeOptions): (value: FormatRelativeTimeValue) => string; } export declare type FormatMessageOptions = { locale?: string; message: string; formats?: MessageFormats; value?: FormatMessageValue; }; export declare type FormatMessageValue = Parameters<IntlMessageFormat['format']>[0]; export interface FormatMessage { (option: FormatMessageOptions): string; } export declare type Formats = { formatMessage: FormatMessage; formatRelativeTime: FormatRelativeTime; formatDatetime: FormatDatetime; formatNumber: FormatNumber; formatPlural: FormatPlural; formatMessageHtml: FormatMessage; };