react-i18next#I18nextProvider JavaScript Examples
The following examples show how to use
react-i18next#I18nextProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: App.js From vindr-lab-viewer with MIT License | 6 votes |
render() {
const { routerBasename } = this._appConfig;
const {
UINotificationService,
UIDialogService,
UIModalService,
} = servicesManager.services;
return (
<ErrorBoundary context="App">
<Provider store={store}>
<AppProvider config={this._appConfig}>
<I18nextProvider i18n={i18n}>
<Router basename={routerBasename}>
<SnackbarProvider service={UINotificationService}>
<DialogProvider service={UIDialogService}>
<ModalProvider modal={OHIFModal} service={UIModalService}>
<OHIFStandaloneViewer />
</ModalProvider>
</DialogProvider>
</SnackbarProvider>
</Router>
</I18nextProvider>
</AppProvider>
</Provider>
</ErrorBoundary>
);
}
Example #2
Source File: withIntl.js From derivcrypto-com with Apache License 2.0 | 6 votes |
WithIntl = () => WrappedComponent => {
const WrapWithIntl = ({ pageContext }, props) => {
const addResources = (pc, language) => {
if (pc && pc.localeResources) {
if (!i18next.hasResourceBundle(language, 'translations')) {
i18next.addResourceBundle(language, 'translations', { ...pc.localeResources })
}
}
}
if (pageContext) {
const current_language = pageContext.locale
if (current_language && current_language !== i18next.language) {
addResources(pageContext, current_language)
i18next.changeLanguage(current_language)
if (isBrowser) {
const normalize_lang = current_language && current_language.replace('_', '-')
initializeWebsocket(normalize_lang)
}
}
}
WrapWithIntl.propTypes = {
pageContext: PropTypes.shape({
locale: PropTypes.string,
}),
}
return (
<I18nextProvider i18n={i18next}>
<WrappedComponent {...props} language={i18next.language} />
</I18nextProvider>
)
}
return WrapWithIntl
}
Example #3
Source File: DepositFormApp.js From react-invenio-deposit with MIT License | 6 votes |
render() {
return (
<Provider store={this.store}>
<I18nextProvider i18n={i18next}>
<DepositBootstrap>{this.props.children}</DepositBootstrap>
</I18nextProvider>
</Provider>
);
}
Example #4
Source File: story-page.web.js From polaris with Apache License 2.0 | 6 votes |
StoryPage = ({ title, storyFn, children, url, width }) => (
<ThemeProvider>
<I18nextProvider i18n={i18n}>
<MemoryRouter>
<View style={[styles.root, { width }]}>
<Title>{title}</Title>
<Text style={styles.url}>{url}</Text>
<Text style={styles.description}>{children}</Text>
{storyFn()}
</View>
</MemoryRouter>
</I18nextProvider>
</ThemeProvider>
)
Example #5
Source File: RootRoute.jsx From movies with MIT License | 6 votes |
RootRoute = (props) => {
const { route, store, i18n } = props;
return (
<Provider store={store}>
<I18nextProvider i18n={i18n}>
<Layout>
{renderRoutes(route.routes)}
</Layout>
</I18nextProvider>
</Provider>
);
}
Example #6
Source File: App.js From covid19 with MIT License | 6 votes |
render() {
return (
<div className="App">
<I18nextProvider i18n={i18n}>
<Provider store={store}>
<Router>
<Route
exact
path={loginPath}
component={AuthProvider(PhysicianView)}
/>
<Route exact path="/physician-public" component={PhysicianView} />
<Route exact path="/about" component={About} />
<Route exact path="/questionView" component={QuestionCard} />
<Route exact path="/" component={AuthProvider(PatientBoard)} />
</Router>
</Provider>
</I18nextProvider>
</div>
);
}
Example #7
Source File: index.jsx From esc-configurator with GNU Affero General Public License v3.0 | 6 votes |
ReactDOM.render( <React.StrictMode> <I18nextProvider i18n={i18next}> <Suspense fallback="loading"> <App /> </Suspense> </I18nextProvider> </React.StrictMode>, document.getElementById('root') );
Example #8
Source File: LanguageProvider.js From vindr-lab-viewer with MIT License | 6 votes |
WrapperI18n = Component => {
const WrapperComponent = props => (
<I18nextProvider i18n={i18n}>
<Component {...props} />
</I18nextProvider>
);
return WrapperComponent;
}
Example #9
Source File: Users.test.js From TrackCOVID-community with MIT License | 6 votes |
test('Users component', () => {
const currentUser = {
username: 'mr_fox',
privilege: 1,
id: 'abc123'
}
const component = TestRenderer.create(
<I18nextProvider i18n={i18n}>
<Users currentUser={currentUser} />
</I18nextProvider>)
expect(component).toMatchSnapshot()
})
Example #10
Source File: Checkpoints.test.js From TrackCOVID-community with MIT License | 6 votes |
test('Checkpoints component', () => {
const status = false
const statusLoaded = true
const component = TestRenderer.create(
<I18nextProvider i18n={i18n}>
<Checkpoints status={status} statusLoaded={statusLoaded} />
</I18nextProvider>)
expect(component).toMatchSnapshot()
})
Example #11
Source File: Exposures.test.js From TrackCOVID-community with MIT License | 6 votes |
test('Exposures component: not exposed', () => {
const status = false
const statusLoaded = true
const component = TestRenderer.create(
<I18nextProvider i18n={i18n}>
<Exposures status={status} statusLoaded={statusLoaded} />
</I18nextProvider>)
expect(component).toMatchSnapshot()
})
Example #12
Source File: Exposures.test.js From TrackCOVID-community with MIT License | 6 votes |
test('Exposures component: exposed', () => {
const status = true
const statusLoaded = true
const component = TestRenderer.create(
<I18nextProvider i18n={i18n}>
<Exposures status={status} statusLoaded={statusLoaded} />
</I18nextProvider>)
expect(component).toMatchSnapshot()
})
Example #13
Source File: Checkpoints.test.js From TrackCOVID-community with MIT License | 5 votes |
test('Checkpoints component', () => {
const component = TestRenderer.create(
<I18nextProvider i18n={i18n}>
<Checkpoints />
</I18nextProvider>)
expect(component).toMatchSnapshot()
})
Example #14
Source File: StatusAlert.test.js From TrackCOVID-community with MIT License | 5 votes |
test('StatusAlert component: not on exposures tab, exposed', () => {
const status = true
const component = TestRenderer.create(
<I18nextProvider i18n={i18n}>
<StatusAlert status={status} />
</I18nextProvider>)
expect(component).toMatchSnapshot()
})
Example #15
Source File: StatusAlert.test.js From TrackCOVID-community with MIT License | 5 votes |
test('StatusAlert component: not on exposures tab, not exposed', () => {
const status = false
const component = TestRenderer.create(
<I18nextProvider i18n={i18n}>
<StatusAlert status={status} />
</I18nextProvider>)
expect(component).toMatchSnapshot()
})
Example #16
Source File: StatusAlert.test.js From TrackCOVID-community with MIT License | 5 votes |
test('StatusAlert component: on exposures tab, exposed', () => {
const status = true
const component = TestRenderer.create(
<I18nextProvider i18n={i18n}>
<StatusAlert status={status} onExposuresTab />
</I18nextProvider>)
expect(component).toMatchSnapshot()
})
Example #17
Source File: StatusAlert.test.js From TrackCOVID-community with MIT License | 5 votes |
test('StatusAlert component: on exposures tab, not exposed', () => {
const status = false
const component = TestRenderer.create(
<I18nextProvider i18n={i18n}>
<StatusAlert status={status} onExposuresTab />
</I18nextProvider>)
expect(component).toMatchSnapshot()
})
Example #18
Source File: App.js From timetable with MIT License | 5 votes |
App = () => (
<I18nextProvider i18n={i18next}>
<ThemeProvider>
<Routes />
</ThemeProvider>
</I18nextProvider>
)
Example #19
Source File: Account.test.js From TrackCOVID-community with MIT License | 5 votes |
test('Account component', () => {
const component = TestRenderer.create(
<I18nextProvider i18n={i18n}>
<Account />
</I18nextProvider>)
expect(component).toMatchSnapshot()
})
Example #20
Source File: App.test.js From TrackCOVID-community with MIT License | 5 votes |
test('App component', () => {
const component = TestRenderer.create(
<I18nextProvider i18n={i18n}>
<App />
</I18nextProvider>)
expect(component).toMatchSnapshot()
})
Example #21
Source File: Internationalize.js From covid-alert with Apache License 2.0 | 5 votes |
Internationalize = ({ children }) => (
<I18nextProvider i18n={Intl.i18n}>{children}</I18nextProvider>
)