Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const flattenArray = arr => | |
arr.reduce((acc, cur) => { | |
if (Array.isArray(cur)) { | |
return acc.concat(flattenArray(cur)) | |
} | |
return acc.concat(cur) | |
}, []) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"dev": "node server.js", | |
"build": "next build", | |
"start": "NODE_ENV=production node server.js" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { i18n, withNamespaces } from '../i18n' | |
class Homepage extends React.Component { | |
static async getInitialProps() { | |
return { | |
namespacesRequired: ['common'], | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const next = require('next') | |
const nextI18NextMiddleware = require('next-i18next/middleware') | |
const nextI18next = require('./i18n') | |
const port = process.env.PORT || 3000 | |
const app = next({ dev: process.env.NODE_ENV !== 'production' }) | |
const handle = app.getRequestHandler(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import App, { Container } from 'next/app' | |
import { appWithTranslation } from '../i18n' | |
class MyApp extends App { | |
render() { | |
const { Component, pageProps } = this.props | |
return ( | |
<Container> | |
<Component {...pageProps} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const NextI18Next = require('next-i18next/dist/commonjs') | |
module.exports = new NextI18Next({ | |
defaultLanguage: 'en', | |
otherLanguages: ['de'] | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "Ich bin ein Satz auf Deutsch." | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "I am a sentence in English." | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"dev": "next", | |
"build": "next build", | |
"start": "next start" | |
} | |
} |
NewerOlder