react-intl

  • Version 10.1.0
  • Published
  • 240 kB
  • 4 dependencies
  • BSD-3-Clause license

Install

npm i react-intl
yarn add react-intl
pnpm add react-intl

Overview

Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.

Index

Variables

variable createIntl

const createIntl: CreateIntlFn<React.ReactNode, IntlConfig, IntlShape>;
  • Create intl object

    Parameter config

    intl config

    Parameter cache

    cache for formatter instances to prevent memory leak

variable FormattedDate

const FormattedDate: React.FC<any>;

    variable FormattedDateParts

    const FormattedDateParts: React.FC<any>;

      variable FormattedDateTimeRange

      const FormattedDateTimeRange: React.FC<Props>;

        variable FormattedDisplayName

        const FormattedDisplayName: React.FC<Intl.DisplayNamesOptions & { value: string }>;

          variable FormattedList

          const FormattedList: React.FC<
          Intl.ListFormatOptions & { value: readonly React.ReactNode[] }
          >;

            variable FormattedListParts

            const FormattedListParts: React.FC<any>;

              variable FormattedMessage

              const FormattedMessage: React.ComponentType<Props<Record<string, any>>>;

                variable FormattedNumber

                const FormattedNumber: React.FC<any>;

                  variable FormattedNumberParts

                  const FormattedNumberParts: React.FC<any>;

                    variable FormattedPlural

                    const FormattedPlural: React.FC<Props>;

                      variable FormattedRelativeTime

                      const FormattedRelativeTime: React.FC<Props>;

                        variable FormattedTime

                        const FormattedTime: React.FC<any>;

                          variable FormattedTimeParts

                          const FormattedTimeParts: React.FC<any>;

                            variable IntlContext

                            const IntlContext: React.Context<IntlShape>;

                              variable IntlProvider

                              const IntlProvider: React.FC<React.PropsWithChildren<IntlConfig>>;

                                variable RawIntlProvider

                                const RawIntlProvider: React.Provider<IntlShape>;

                                  Functions

                                  function defineMessage

                                  defineMessage: <T extends MessageDescriptor>(msg: T) => T;

                                    function defineMessages

                                    defineMessages: <
                                    K extends string | number | symbol,
                                    T = MessageDescriptor,
                                    U extends Record<K, T> = Record<K, T>
                                    >(
                                    msgs: U
                                    ) => U;

                                      function useIntl

                                      useIntl: (this: void) => IntlShape;

                                        Interfaces

                                        interface IntlShape

                                        interface IntlShape extends ResolvedIntlConfig, IntlFormatters<React.ReactNode> {}

                                          property formatters

                                          formatters: Formatters;

                                            method formatMessage

                                            formatMessage: {
                                            (
                                            this: void,
                                            descriptor: MessageDescriptor,
                                            values?: Record<
                                            string,
                                            PrimitiveType | FormatXMLElementFn<string, string>
                                            >,
                                            opts?: IntlMessageFormatOptions
                                            ): string;
                                            (
                                            this: void,
                                            descriptor: MessageDescriptor,
                                            values?: Record<string, any>,
                                            opts?: IntlMessageFormatOptions
                                            ): React.ReactNode[];
                                            };

                                              interface ResolvedIntlConfig

                                              interface ResolvedIntlConfig extends CoreResolvedIntlConfig<React.ReactNode> {}

                                                property textComponent

                                                textComponent?: React.ComponentType | keyof React.JSX.IntrinsicElements;

                                                  property wrapRichTextChunksInFragment

                                                  wrapRichTextChunksInFragment?: boolean;

                                                    Type Aliases

                                                    type IntlConfig

                                                    type IntlConfig = Omit<ResolvedIntlConfig, keyof typeof DEFAULT_INTL_CONFIG> &
                                                    Partial<typeof DEFAULT_INTL_CONFIG>;

                                                      Package Files (11)

                                                      Dependencies (4)

                                                      Dev Dependencies (0)

                                                      No dev dependencies.

                                                      Peer Dependencies (3)

                                                      Badge

                                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/react-intl.

                                                      • Markdown
                                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/react-intl)
                                                      • HTML
                                                        <a href="https://www.jsdocs.io/package/react-intl"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>