react-intl
Version:
Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.
37 lines • 1.38 kB
TypeScript
import * as React from 'react';
import { DEFAULT_INTL_CONFIG } from '../utils';
import { IntlConfig, IntlShape } from '../types';
import { IntlCache, CreateIntlFn } from '@formatjs/intl';
interface State {
/**
* Explicit intl cache to prevent memory leaks
*/
cache: IntlCache;
/**
* Intl object we created
*/
intl?: IntlShape;
/**
* list of memoized config we care about.
* This is important since creating intl is
* very expensive
*/
prevConfig: OptionalIntlConfig;
}
export declare type OptionalIntlConfig = Omit<IntlConfig, keyof typeof DEFAULT_INTL_CONFIG> & Partial<typeof DEFAULT_INTL_CONFIG>;
/**
* Create intl object
* @param config intl config
* @param cache cache for formatter instances to prevent memory leak
*/
export declare const createIntl: CreateIntlFn<React.ReactNode>;
export default class IntlProvider extends React.PureComponent<React.PropsWithChildren<OptionalIntlConfig>, State> {
static displayName: string;
static defaultProps: Pick<IntlConfig, "timeZone" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "onError" | "textComponent">;
private cache;
state: State;
static getDerivedStateFromProps(props: OptionalIntlConfig, { prevConfig, cache }: State): Partial<State> | null;
render(): JSX.Element;
}
export {};
//# sourceMappingURL=provider.d.ts.map