2017-04-30 14:35:07 +00:00
|
|
|
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'
|
|
|
|
|
2017-05-17 17:41:54 +00:00
|
|
|
// get language from query parameter or url path
|
|
|
|
const lang = 'id'
|
|
|
|
|
2017-04-30 14:35:07 +00:00
|
|
|
export default class Homepage extends Component {
|
|
|
|
static async getInitialProps () {
|
2017-05-17 17:41:54 +00:00
|
|
|
const translations = await getTranslation(lang, 'common', 'http://localhost:3000/static/locales/')
|
2017-04-30 14:35:07 +00:00
|
|
|
|
|
|
|
return { translations }
|
|
|
|
}
|
|
|
|
|
|
|
|
constructor (props) {
|
|
|
|
super(props)
|
|
|
|
|
2017-05-17 17:41:54 +00:00
|
|
|
this.i18n = startI18n(props.translations, lang)
|
2017-04-30 14:35:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render (props) {
|
|
|
|
return (
|
|
|
|
<I18nextProvider i18n={this.i18n}>
|
|
|
|
<Title />
|
2017-06-13 06:57:07 +00:00
|
|
|
</I18nextProvider>
|
2017-04-30 14:35:07 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|