Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

LocalizationProvider

Staś Małolepszy edited this page Apr 7, 2020 · 5 revisions

In @fluent/react, all <Localized> components need access to an instance of the ReactLocalization class, the central localization store to which they subscribe. The <LocalizationProvider> component takes advantage of React's Context API and makes translations available to all localized elements in the app without passing them explicitly.

ReactDOM.render(
    <LocalizationProvider l10n={}>
        </App />
    </LocalizationProvider>,
    document.getElementById('root')
);

The LocalizationProvider component takes one prop: l10n. It should be an instance of ReactLocalization holding a sequence of FluentBundle instances which will be used — in order — to format translations. If a translation is missing in one bundle, ReactLocalization will fall back to the next one.

Clone this wiki locally

Morty Proxy This is a proxified and sanitized view of the page, visit original site.