Skip to content

Commit 5780e6b

Browse files
authored
feat: Add support for next-i18next (#1331)
* chore: running npm install after version was updated in main * feat: add demo for internationalization * feat: add next-i18next files to included_files * test: add files to test * chore: remove readme * chore: remove confusing lang in readmes * chore: re-add accidentally deleted readme * chore: add site url for demo * chore: force to always build so cypress runs work * chore: remove redefined value * chore: force new build with diff * chore: prettier
1 parent ddcab6b commit 5780e6b

File tree

19 files changed

+5552
-42
lines changed

19 files changed

+5552
-42
lines changed

demos/base-path/README.md

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with
2+
[`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
23

34
## Getting Started
45

@@ -14,9 +15,11 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the
1415

1516
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
1617

17-
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
18+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on
19+
[http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
1820

19-
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
21+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as
22+
[API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
2023

2124
## Learn More
2225

@@ -25,10 +28,5 @@ To learn more about Next.js, take a look at the following resources:
2528
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
2629
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
2730

28-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29-
30-
## Deploy on Vercel
31-
32-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33-
34-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
31+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions
32+
are welcome!

demos/next-auth/README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ cp .env.local.example .env.local
2424
Add details for the [Netlify Provider](https://next-auth.js.org/providers/netlify), which will require create a Netlify OAuth application.
2525

2626
To create a Netlify OAuth application:
27-
* Visit `https://app.netlify.com/user/applications`
28-
* Click 'New OAuth App'
29-
* Enter an application name
30-
* Enter a redirect URI (for the purposes of this demo application you would use `http://localhost:3000/api/auth/callback/netlify`)
31-
* Save the application, and copy the value for 'Client ID' as the `NETLIFY_CLIENT_ID` and the 'Client Secret' as the `NETLIFY_CLIENT_SECRET` into your `.env.local` file within the project
32-
* If you're testing this on a deployed Netlify site you'll need to set the environment variables as part of the `Site Settings > Build & Deploy > Environment` settings. You'll also need to generate a `NEXTAUTH_SECRET` environment variable and set that for a production build.
27+
28+
- Visit `https://app.netlify.com/user/applications`
29+
- Click 'New OAuth App'
30+
- Enter an application name
31+
- Enter a redirect URI (for the purposes of this demo application you would use `http://localhost:3000/api/auth/callback/netlify`)
32+
- Save the application, and copy the value for 'Client ID' as the `NETLIFY_CLIENT_ID` and the 'Client Secret' as the `NETLIFY_CLIENT_SECRET` into your `.env.local` file within the project
33+
- If you're testing this on a deployed Netlify site you'll need to set the environment variables as part of the `Site Settings > Build & Deploy > Environment` settings. You'll also need to generate a `NEXTAUTH_SECRET` environment variable and set that for a production build.
3334

3435
For configuring additional authentication providers, see the original documentation [here](https://github.com/nextauthjs/next-auth-example#3-configure-authentication-providers)

demos/next-i18next/.eslintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

demos/next-i18next/.gitignore

+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
.pnpm-debug.log*
27+
28+
# local env files
29+
.env*.local
30+
31+
# vercel
32+
.vercel
33+
# Logs
34+
logs
35+
*.log
36+
npm-debug.log*
37+
yarn-debug.log*
38+
yarn-error.log*
39+
lerna-debug.log*
40+
.pnpm-debug.log*
41+
42+
# Diagnostic reports (https://nodejs.org/api/report.html)
43+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
44+
45+
# Runtime data
46+
pids
47+
*.pid
48+
*.seed
49+
*.pid.lock
50+
51+
# Directory for instrumented libs generated by jscoverage/JSCover
52+
lib-cov
53+
54+
# Coverage directory used by tools like istanbul
55+
coverage
56+
*.lcov
57+
58+
# nyc test coverage
59+
.nyc_output
60+
61+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
62+
.grunt
63+
64+
# Bower dependency directory (https://bower.io/)
65+
bower_components
66+
67+
# node-waf configuration
68+
.lock-wscript
69+
70+
# Compiled binary addons (https://nodejs.org/api/addons.html)
71+
build/Release
72+
73+
# Dependency directories
74+
node_modules/
75+
jspm_packages/
76+
77+
# Snowpack dependency directory (https://snowpack.dev/)
78+
web_modules/
79+
80+
# TypeScript cache
81+
*.tsbuildinfo
82+
83+
# Optional npm cache directory
84+
.npm
85+
86+
# Optional eslint cache
87+
.eslintcache
88+
89+
# Optional stylelint cache
90+
.stylelintcache
91+
92+
# Microbundle cache
93+
.rpt2_cache/
94+
.rts2_cache_cjs/
95+
.rts2_cache_es/
96+
.rts2_cache_umd/
97+
98+
# Optional REPL history
99+
.node_repl_history
100+
101+
# Output of 'npm pack'
102+
*.tgz
103+
104+
# Yarn Integrity file
105+
.yarn-integrity
106+
107+
# dotenv environment variable files
108+
.env
109+
.env.development.local
110+
.env.test.local
111+
.env.production.local
112+
.env.local
113+
114+
# parcel-bundler cache (https://parceljs.org/)
115+
.cache
116+
.parcel-cache
117+
118+
# Next.js build output
119+
.next
120+
out
121+
122+
# Nuxt.js build / generate output
123+
.nuxt
124+
dist
125+
126+
# Gatsby files
127+
.cache/
128+
# Comment in the public line in if your project uses Gatsby and not Next.js
129+
# https://nextjs.org/blog/next-9-1#public-directory-support
130+
# public
131+
132+
# vuepress build output
133+
.vuepress/dist
134+
135+
# vuepress v2.x temp and cache directory
136+
.temp
137+
.cache
138+
139+
# Docusaurus cache and generated files
140+
.docusaurus
141+
142+
# Serverless directories
143+
.serverless/
144+
145+
# FuseBox cache
146+
.fusebox/
147+
148+
# DynamoDB Local files
149+
.dynamodb/
150+
151+
# TernJS port file
152+
.tern-port
153+
154+
# Stores VSCode versions used for testing VSCode extensions
155+
.vscode-test
156+
157+
# yarn v2
158+
.yarn/cache
159+
.yarn/unplugged
160+
.yarn/build-state.yml
161+
.yarn/install-state.gz
162+
.pnp.*

demos/next-i18next/README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with
2+
[`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
3+
4+
## Getting Started
5+
6+
To visit this demo site, visit [https://next-i18next-demo.netlify.app/](https://next-i18next-demo.netlify.app/)
7+
8+
First, run the development server:
9+
10+
```bash
11+
npm run dev
12+
# or
13+
yarn dev
14+
```
15+
16+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
17+
18+
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
19+
20+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on
21+
[http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
22+
23+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as
24+
[API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
25+
26+
## Learn More
27+
28+
To learn more about Next.js, take a look at the following resources:
29+
30+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
31+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
32+
33+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions
34+
are welcome!

demos/next-i18next/netlify.toml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[build]
2+
command = "next build"
3+
publish = ".next"
4+
ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../../plugin"
5+
6+
[build.environment]
7+
TERM = "xterm"
8+
NODE_VERSION = "17"
9+
10+
[[plugins]]
11+
package = "../plugin-wrapper/"
12+
13+
# This is a fake plugin, that makes it run npm install
14+
[[plugins]]
15+
package = "@netlify/plugin-local-install-core"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
i18n: {
3+
defaultLocale: 'en',
4+
locales: ['en', 'fr'],
5+
},
6+
}

demos/next-i18next/next.config.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const { i18n } = require('./next-i18next.config')
2+
3+
/** @type {import('next').NextConfig} */
4+
const nextConfig = {
5+
reactStrictMode: true,
6+
eslint: {
7+
// Warning: This allows production builds to successfully complete even if
8+
// your project has ESLint errors.
9+
ignoreDuringBuilds: true,
10+
},
11+
i18n,
12+
}
13+
14+
module.exports = nextConfig

0 commit comments

Comments
 (0)