1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/examples/with-react-i18next/pages/_app.js

31 lines
921 B
JavaScript

import React from 'react'
import App, { Container } from 'next/app'
import { I18n as I18nR, I18nextProvider } from 'react-i18next'
import initialI18nInstance from '../i18n'
import LanguageSwitch from '../components/LanguageSwitch'
export default class MyApp extends App {
render () {
const { Component, pageProps } = this.props
const { i18n, initialI18nStore, initialLanguage } = pageProps || {}
return (
<Container>
<I18nextProvider
i18n={i18n || initialI18nInstance}
initialI18nStore={initialI18nStore}
initialLanguage={initialLanguage}
>
<React.Fragment>
<I18nR ns='common' wait>
{t => <h1>{t('common:integrates_react-i18next')}</h1>}
</I18nR>
<LanguageSwitch />
<Component {...pageProps} />
</React.Fragment>
</I18nextProvider>
</Container>
)
}
}