Skip to content

Commit

Permalink
Update next-translate example to support Next 10 with i18n routing (#…
Browse files Browse the repository at this point in the history
…18480)

Co-authored-by: Joe Haddad <[email protected]>
  • Loading branch information
aralroca and Timer authored Nov 3, 2020
1 parent 4620dcc commit 44ea598
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
6 changes: 3 additions & 3 deletions examples/with-next-translate/_pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Link from 'next-translate/Link'
import Link from 'next/link'
import Trans from 'next-translate/Trans'
import useTranslation from 'next-translate/useTranslation'
import Layout from '../components/Layout'
Expand All @@ -22,14 +22,14 @@ export default function Home() {
</p>

<div className="grid">
<Link href="/" lang="en">
<Link href="/" locale="en">
<div className="card">
<h3>{t('home:english')}</h3>
<p>{t('home:change-english')}</p>
</div>
</Link>

<Link href="/" lang="ca">
<Link href="/" locale="ca">
<div className="card">
<h3>{t('home:catalan')}</h3>
<p>{t('home:change-catalan')}</p>
Expand Down
4 changes: 2 additions & 2 deletions examples/with-next-translate/i18n.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"allLanguages": ["en", "ca"],
"defaultLanguage": "en",
"locales": ["en", "ca"],
"defaultLocale": "en",
"currentPagesDir": "_pages",
"finalPagesDir": "pages",
"localesPath": "locales",
Expand Down
8 changes: 8 additions & 0 deletions examples/with-next-translate/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { locales, defaultLocale } = require('./i18n.json')

module.exports = {
i18n: {
locales,
defaultLocale,
},
}
8 changes: 4 additions & 4 deletions examples/with-next-translate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"start": "next start"
},
"dependencies": {
"next": "9.4.4",
"next-translate": "0.16.1",
"react": "16.13.1",
"react-dom": "16.13.1"
"next": "10.0.0",
"next-translate": "0.19.0",
"react": "17.0.1",
"react-dom": "17.0.1"
},
"license": "MIT"
}

0 comments on commit 44ea598

Please sign in to comment.