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.
28 lines (27 loc) • 1.33 kB
TypeScript
import { type FormatDateOptions, type FormatDisplayNameOptions, type FormatListOptions, type FormatNumberOptions } from "@formatjs/intl";
import * as React from "react";
import { type IntlShape } from "../types.js";
type Formatter = {
formatDate: FormatDateOptions;
formatTime: FormatDateOptions;
formatNumber: FormatNumberOptions;
formatList: FormatListOptions;
formatDisplayName: FormatDisplayNameOptions;
};
export declare const FormattedNumberParts: React.FC<Formatter["formatNumber"] & {
value: Parameters<IntlShape["formatNumber"]>[0];
children(val: Intl.NumberFormatPart[]): React.ReactElement | null;
}>;
export declare const FormattedListParts: React.FC<Formatter["formatList"] & {
value: Parameters<IntlShape["formatList"]>[0];
children(val: ReturnType<Intl.ListFormat["formatToParts"]>): React.ReactElement | null;
}>;
export declare function createFormattedDateTimePartsComponent<Name extends "formatDate" | "formatTime">(name: Name): React.FC<Formatter[Name] & {
value: Parameters<IntlShape[Name]>[0];
children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
}>;
export declare function createFormattedComponent<Name extends keyof Formatter>(name: Name): React.FC<Formatter[Name] & {
value: Parameters<IntlShape[Name]>[0];
children?(val: string): React.ReactElement | null;
}>;
export {};