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-i18next/pages/index.js
Átila Fassina c9d0670362 with-i18next example (#1496)
* examples/with-i18next: create folder and initial settings

* examples/with-i18next:abstract url and object keys - finish readme

* examples/with-i18next: next@beta is not actually necessary

* examples/with-it18next: fix standardjs eslint warnings

* examples/with-i18next: review updates
2017-04-30 07:35:07 -07:00

28 lines
679 B
JavaScript

import React, { Component } from 'react'
import { I18nextProvider } from 'react-i18next'
import startI18n from '../tools/startI18n'
import { getTranslation } from '../tools/translationHelpers'
import Title from '../components/Title'
export default class Homepage extends Component {
static async getInitialProps () {
const translations = await getTranslation('pt', 'common', 'http://localhost:3000/static/locales/')
return { translations }
}
constructor (props) {
super(props)
this.i18n = startI18n(props.translations)
}
render (props) {
return (
<I18nextProvider i18n={this.i18n}>
<Title />
</ I18nextProvider>
)
}
}