declare namespace I18n { type Scope = string | string[] let defaultLocale: string let locale: string let defaultSeparator: string let placeholder: RegExp let fallbacks: boolean let missingBehaviour: 'message' | 'guess' let missingTranslationPrefix: string // tslint:disable-next-line prefer-declare-function let missingTranslation: ( scope: string, options?: TranslateOptions ) => string | null | undefined // tslint:disable-next-line prefer-declare-function let missingPlaceholder: ( placeholder: string, message: string, options?: InterpolateOptions ) => string | null | undefined // tslint:disable-next-line prefer-declare-function let nullPlaceholder: ( placeholder: string, message: string, options?: InterpolateOptions ) => string | null | undefined let translations: { [locale: string]: object } let locales: { [key: string]: string | string[] | ((locale: string) => string | string[]) } let pluralization: { [locale: string]: (count: number) => string[] } function reset(): void function currentLocale(): string interface InterpolateOptions { [key: string]: any // interpolation } interface TranslateOptions extends InterpolateOptions { scope?: Scope message?: string defaults?: Array<{ message: string } | { scope: Scope }> defaultValue?: string } function translate(scope: Scope, options?: TranslateOptions): string function t(scope: Scope, options?: TranslateOptions): string function localize( scope: 'currency' | 'number' | 'percentage', value: number, options?: InterpolateOptions ): string function localize( scope: Scope, value: string | number | Date, options?: InterpolateOptions ): string function l( scope: 'currency' | 'number' | 'percentage', value: number, options?: InterpolateOptions ): string function l( scope: Scope, value: string | number | Date, options?: InterpolateOptions ): string interface ToNumberOptions { precision?: number separator?: string delimiter?: string strip_insignificant_zeros?: boolean } function toNumber(num: number, options?: ToNumberOptions): string type ToPercentageOptions = ToNumberOptions function toPercentage(num: number, options?: ToPercentageOptions): string interface ToCurrencyOptions extends ToNumberOptions { format?: string unit?: string sign_first?: boolean } function toCurrency(num: number, options?: ToCurrencyOptions): string function toTime(scope: Scope, value: string | number | Date): string interface ToHumanSizeOptions extends ToNumberOptions { format?: string } function toHumanSize(num: number, options?: ToHumanSizeOptions): string function strftime(date: Date, format: string): string } declare module '@procore/core-i18n-js' { type VendorI18n = typeof I18n export const locale = { en: 'en', enCA: 'en-CA', frCA: 'fr-CA', es: 'es', AU: 'en-AU', enGB: 'en-GB', ko: 'ko', th: 'th-TH', pt: 'pt', is: 'is-IS', pseudo: 'pseudo', } as const export type Locale = typeof locale[keyof typeof locale] interface I18njs extends VendorI18n { locale: Locale } interface I18njsConfig { I18n?: I18njs locale?: Locale translations?: {} } function createI18njs(config: I18njsConfig): I18njs }