I18nProvider

Provides the locale for the application to all child components.

installyarn add @react-aria/i18n
version3.0.0
usageimport {I18nProvider} from '@react-aria/i18n'

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
childrenReactNode—Contents that should have the locale applied.
localestring—The locale to apply to the children.

Example#


import {I18nProvider} from '@react-aria/i18n';

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

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

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