Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
7a937505
Commit
7a937505
authored
Feb 18, 2018
by
Jan Mühlemann
Committed by
Tim Neutkens
Feb 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update with-react-i18next sample with latest dependencies (#3835)
parent
7e756ee5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
package.json
examples/with-react-i18next/package.json
+7
-7
server.js
examples/with-react-i18next/server.js
+3
-3
No files found.
examples/with-react-i18next/package.json
View file @
7a937505
...
...
@@ -11,15 +11,15 @@
"author"
:
""
,
"license"
:
"MIT"
,
"dependencies"
:
{
"express"
:
"4.1
5.3
"
,
"i18next"
:
"
8.4.2
"
,
"i18next-browser-languagedetector"
:
"2.
0
.0"
,
"i18next-express-middleware"
:
"1.0.
5
"
,
"express"
:
"4.1
6.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
"
}
}
examples/with-react-i18next/server.js
View file @
7a937505
...
...
@@ -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'
)
})
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment