update with-react-i18next sample with latest dependencies (#3835)

This commit is contained in:
Jan Mühlemann 2018-02-18 12:41:40 +01:00 committed by Tim Neutkens
parent 7e756ee5d9
commit 7a937505f5
2 changed files with 10 additions and 10 deletions

View file

@ -11,15 +11,15 @@
"author": "",
"license": "MIT",
"dependencies": {
"express": "4.15.3",
"i18next": "8.4.2",
"i18next-browser-languagedetector": "2.0.0",
"i18next-express-middleware": "1.0.5",
"express": "4.16.2",
"i18next": "10.4.1",
"i18next-browser-languagedetector": "2.1.0",
"i18next-express-middleware": "1.0.10",
"i18next-node-fs-backend": "1.0.0",
"i18next-xhr-backend": "1.4.2",
"next": "latest",
"i18next-xhr-backend": "1.5.1",
"next": "5.0.0",
"react": "16.2.0",
"react-dom": "16.2.0",
"react-i18next": "4.6.3"
"react-i18next": "7.3.6"
}
}

View file

@ -2,7 +2,6 @@ const express = require('express')
const path = require('path')
const next = require('next')
const port = parseInt(process.env.PORT, 10) || 3000
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()
@ -17,6 +16,7 @@ i18n
.use(Backend)
.use(i18nextMiddleware.LanguageDetector)
.init({
fallbackLng: 'en',
preload: ['en', 'de'], // preload all langages
ns: ['common', 'home', 'page2'], // need to preload all the namespaces
backend: {
@ -41,9 +41,9 @@ i18n
// use next.js
server.get('*', (req, res) => handle(req, res))
server.listen(port, (err) => {
server.listen(3000, (err) => {
if (err) throw err
console.log(`> Ready on http://localhost:${port}`)
console.log('> Ready on http://localhost:3000')
})
})
})