I18nProvider

Provides the locale for the application to all child components.

installyarn add react-aria
version3.23.1
usageimport {I18nProvider} from 'react-aria'

Introduction#


I18nProvider allows you to override the default locale as determined by the browser/system setting with a locale defined by your application (e.g. application setting). This should be done by wrapping your entire application in the provider, which will be cause all child elements to receive the new locale information via useLocale.

Props#


NameTypeDefaultDescription
childrenReactNodeContents that should have the locale applied.
localestringThe locale to apply to the children.

Example#


import {I18nProvider} from 'react-aria';

<I18nProvider locale="fr-FR">
  <YourApp />
</I18nProvider>
import {I18nProvider} from 'react-aria';

<I18nProvider locale="fr-FR">
  <YourApp />
</I18nProvider>
import {I18nProvider} from 'react-aria';

<I18nProvider locale="fr-FR">
  <YourApp />
</I18nProvider>