react-intl

  • Version 10.1.3
  • Published
  • 180 kB
  • 3 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 DEFAULT_INTL_CONFIG$1

const DEFAULT_INTL_CONFIG$1: DefaultIntlConfig;

    variable FormattedDate

    const FormattedDate: React.FC<any>;

      variable FormattedDateParts

      const FormattedDateParts: React.FC<any>;

        variable FormattedDateTimeRange

        const FormattedDateTimeRange: React.FC<Props$3>;

          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$2<Record<string, any>>>;

                  variable FormattedNumber

                  const FormattedNumber: React.FC<any>;

                    variable FormattedNumberParts

                    const FormattedNumberParts: React.FC<any>;

                      variable FormattedPlural

                      const FormattedPlural: React.FC<Props$1>;

                        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$1>(msg: T) => T;

                                      function defineMessages

                                      defineMessages: <
                                      K extends string | number | symbol,
                                      T = MessageDescriptor$1,
                                      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$1<React.ReactNode> {}

                                            property formatters

                                            formatters: Formatters$1;

                                              method formatMessage

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

                                                interface ResolvedIntlConfig

                                                interface ResolvedIntlConfig extends ResolvedIntlConfig$1<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$1> &
                                                      Partial<typeof DEFAULT_INTL_CONFIG$1>;

                                                        Package Files (1)

                                                        Dependencies (3)

                                                        Dev Dependencies (0)

                                                        No dev dependencies.

                                                        Peer Dependencies (2)

                                                        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>