import React, { Component } from 'react'; import { UnknownProperties } from '../core'; export type LocaleKeys = string; export type DictionaryItem = { [key: string]: string; }; export type Dictionary = { [locale: string]: DictionaryItem | (() => Promise); }; export declare const Context: React.Context; declare const I18nProvider: React.Provider, I18nConsumer: React.Consumer; declare function getText(dictionaries: Dictionary, locale: LocaleKeys): (key: keyof DictionaryItem) => any; /** @deprecated */ export interface IWithI18nInjectedProps extends WithI18nInjectedProps, UnknownProperties { } export type WithI18nInjectedProps = { getText: WithI18n['getText']; }; /** @deprecated */ export interface IWithI18nProps extends WithI18nProps, UnknownProperties { } export type WithI18nProps = WithI18nInjectedProps & { locale?: LocaleKeys; children?(props: IWithI18nInjectedProps): React.ReactNode; }; /** * @deprecated use `useI18n` instead */ declare class WithI18n extends Component { context: LocaleKeys; static contextType: React.Context; static defaultProps: { getText: typeof getText; }; getText: (dictionary: Dictionary, selfLocale?: string) => string; render(): any; } declare const useI18n: (dictionary: Dictionary, locale?: LocaleKeys, fallbackDictionary?: Dictionary) => (messageId: string, variables?: { [key: string]: string | number | undefined; } | undefined) => string; declare const _default: (options?: {} | undefined) => (WrappedComponent: React.ComponentType) => React.ComponentClass<{}, any>; export default _default; export { useI18n, I18nProvider, I18nConsumer };