From 7a937505f5e184d33f8e8dceaa178c5d07da2092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=BChlemann?= Date: Sun, 18 Feb 2018 12:41:40 +0100 Subject: [PATCH] update with-react-i18next sample with latest dependencies (#3835) --- examples/with-react-i18next/package.json | 14 +++++++------- examples/with-react-i18next/server.js | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/with-react-i18next/package.json b/examples/with-react-i18next/package.json index a427dfcd..f69b9713 100644 --- a/examples/with-react-i18next/package.json +++ b/examples/with-react-i18next/package.json @@ -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" } } diff --git a/examples/with-react-i18next/server.js b/examples/with-react-i18next/server.js index d3b62e80..5f2686e8 100644 --- a/examples/with-react-i18next/server.js +++ b/examples/with-react-i18next/server.js @@ -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') }) }) })