Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Next.js 13 RSC integration #149

Merged
merged 378 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 200 commits
Commits
Show all changes
378 commits
Select commit Hold shift + click to select a range
b301d47
Improve docs
amannn Feb 13, 2023
436b0bb
Use `.ts` extension where possible in the docs
amannn Feb 14, 2023
53beb17
Use `.ts` extension in examples where possible
amannn Feb 14, 2023
63b279a
One more `tsx` -> `ts`
amannn Feb 14, 2023
f0bceeb
3.0.0-beta.1
amannn Feb 14, 2023
643af24
Revert "3.0.0-beta.1"
amannn Feb 14, 2023
a78b375
Add `use client` to `usePathname` so `NextIntlClientProvider` can sti…
wxh06 Feb 14, 2023
1df0996
2.11.0-beta.9
amannn Feb 14, 2023
70be9b0
Keep search params in middleware
amannn Feb 14, 2023
7c0d88b
2.11.0-beta.10
amannn Feb 14, 2023
bc41740
Add test for new API routes
amannn Feb 16, 2023
5d6ce8a
Use latest stable version of Next.js
amannn Feb 16, 2023
026691e
Use canary with support for new metadata API
amannn Feb 16, 2023
695c65b
Fix path in server-components.mdx (#191)
Tobi-mmt Feb 16, 2023
9b564f9
fix: Handle invalid `accept-language` header gracefully (#192)
CptCompiler Feb 17, 2023
5a6434a
Improve docs
amannn Feb 17, 2023
1deee08
2.11.0-beta.12
amannn Feb 17, 2023
7a76d2b
Default to disabling prefetching in `Link` when a `locale` is passed …
amannn Feb 19, 2023
9c843c9
Add image example and add clarification for `public` folder to docs
amannn Feb 19, 2023
5af108c
2.11.0-beta.13
amannn Feb 19, 2023
6878636
Add test for localized API routes in latest beta
amannn Feb 19, 2023
42c1155
Remove `api` from matcher
amannn Feb 19, 2023
e0bd177
fix: Add tests to ensure links work and downgrade Next.js (#196)
amannn Feb 19, 2023
f55424a
feat: Return alternate language links as headers from middleware (#195)
amannn Feb 19, 2023
8fc47fd
2.11.0-beta.15
amannn Feb 19, 2023
7dc5011
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Feb 19, 2023
f849669
Styling improvements for RSC docs
amannn Feb 19, 2023
629b3f4
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Feb 19, 2023
2aee5ea
Minor wording fixes
amannn Feb 19, 2023
531caaa
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Feb 20, 2023
1e77472
Fix not-found example
amannn Feb 21, 2023
6bae9cf
Fix build
amannn Feb 21, 2023
3d25ca5
Improve middleware docs
amannn Feb 21, 2023
c8566d6
Add docs about localized rewrites
amannn Feb 21, 2023
298dea8
Wording
amannn Feb 21, 2023
9112475
Gracefully handle invalid locales saved in the cookie
amannn Feb 21, 2023
b5cd0da
Named routes example for localized pathnames
amannn Feb 21, 2023
ab59451
Improve link
amannn Feb 21, 2023
1b2f3b2
Improve styling for callouts
amannn Feb 22, 2023
984a47a
docs: Improve landing page design (#200)
amannn Feb 22, 2023
dfa82ef
chore: Upgrade to Next.js 13.2 (#201)
amannn Feb 27, 2023
fc861f6
2.11.0-beta.16
amannn Feb 27, 2023
0eaeefa
Landing page finetuning
amannn Feb 27, 2023
b2f9112
Code samples for features on landing page
amannn Feb 27, 2023
bc1a5a6
Improve landing page
amannn Feb 28, 2023
ed64e22
Improve phrasing of landing page
amannn Feb 28, 2023
e351444
Add number example to landing page
amannn Feb 28, 2023
a52a74d
Add caching docs and test
amannn Mar 2, 2023
e076182
feat: Improve landing page design (#207)
amannn Mar 3, 2023
335243d
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Mar 3, 2023
f24919a
chore: Rebase Next.js 13 RSC (#211)
amannn Mar 6, 2023
87e77db
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Mar 6, 2023
a608512
v2.12.0-alpha.1
amannn Mar 6, 2023
b6f720a
v2.12.0-beta.1
amannn Mar 6, 2023
94e0a37
2.12.0-beta.1
amannn Mar 6, 2023
42a9b79
Include deprecation warning for `useIntl` in RSC
amannn Mar 6, 2023
c8b61b5
Simplify code snippet and get rid of tailwind warning
amannn Mar 6, 2023
9d2e025
Compile to ES2019
amannn Mar 10, 2023
2e9288e
2.12.0-beta.2
amannn Mar 10, 2023
cc6c9b8
feat: Next.js 13 RSC middleware improvements (#212)
amannn Mar 13, 2023
1ae18c1
[email protected]
amannn Mar 13, 2023
666c1df
feat: Improve named routes implementation (#213)
amannn Mar 14, 2023
0472497
Export `getFormatter`
amannn Mar 14, 2023
fe46d95
2.12.0-beta.4
amannn Mar 14, 2023
3d7cc1d
feat: Improve locale detection for prefixed routing (#214)
amannn Mar 14, 2023
b965568
2.12.0-beta.5
amannn Mar 14, 2023
7315a41
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Mar 15, 2023
8a30f81
Link to article on Smashing Magazine
amannn Mar 17, 2023
d60e63f
Improve wording about usage in Client Components
amannn Mar 17, 2023
17b245e
Improve error message for static rendering
amannn Mar 17, 2023
89e90e2
Upgrade example-next-13-with-pages to latest Next.js version
amannn Mar 17, 2023
79d95cc
Add Vercel Analytics
amannn Mar 21, 2023
93ccd0a
Fix typo (thanks to @frans-slabbekoorn!)
amannn Apr 3, 2023
36ae25d
feat: Next.js 13 RSC Domain middleware improvements (#223)
amannn Apr 5, 2023
f089e33
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Apr 5, 2023
da97714
v2.13.0-beta.1
amannn Apr 5, 2023
eb4fd67
Wording & latest beta
amannn Apr 5, 2023
dfb33fa
Fix link
amannn Apr 5, 2023
30232d6
Improve code samples
amannn Apr 5, 2023
cf87920
Use type-signatures from client-side in Server Component hooks to ens…
amannn Apr 6, 2023
bce9480
Include note about locales support in Polyfill.io (h/t to @alvarlager…
amannn Apr 6, 2023
5e3fb47
`localeDetection: false` should ignore the cookie too
amannn Apr 6, 2023
f7ce3ea
v2.13.0-beta.2
amannn Apr 6, 2023
7cc3b6c
2.13.0-beta.2
amannn Apr 6, 2023
21e9eae
Wording
amannn Apr 6, 2023
018c65b
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Apr 7, 2023
52195be
Add Google site verification to docs
amannn Apr 11, 2023
1c65538
Add sitemap
amannn Apr 11, 2023
b06d985
Static sitemap domain
amannn Apr 11, 2023
5ae58bb
chore: Rebase Next.js 13 RSC integration (#239)
amannn Apr 12, 2023
3e30b7b
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Apr 12, 2023
de5115c
fix: Fix type signature of the plugin and improve condition for print…
Apr 13, 2023
a8cf8f9
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Apr 13, 2023
f215760
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Apr 14, 2023
d60307b
Unnecessary destructuring
amannn Apr 14, 2023
d177b69
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Apr 27, 2023
c49dc2f
Fix lockfile
amannn Apr 27, 2023
a08b91b
feat: Improvements for localized `Link` (#257)
amannn Apr 27, 2023
84dc3b3
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn May 2, 2023
bb9c7c2
Single playwright version
amannn May 2, 2023
b844b1a
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn May 3, 2023
344762f
Update next and playwright to match versions
amannn May 3, 2023
7435a61
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc-reba…
amannn May 4, 2023
3f64a4f
Fix playwright install
amannn May 4, 2023
61e200b
Distinct ports
amannn May 4, 2023
dd9aa33
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc-reba…
amannn May 4, 2023
782d103
Update Next.js for newer examples
amannn May 4, 2023
25b22e4
Skip broken test
amannn May 4, 2023
4b8b6ba
Update lockfile
amannn May 4, 2023
b0f8d6e
chore: Rebase RSC (#272)
amannn May 4, 2023
23f44e2
fix(Next.js 13 RSC): Improvements for routing APIs (#277)
amannn May 9, 2023
73149e0
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn May 9, 2023
504f5f7
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc-reba…
amannn May 10, 2023
0ffb615
Fix lint
amannn May 10, 2023
f18e467
Remove unused files
amannn May 10, 2023
1b03065
feat(Next.js 13 RSC): Rebase (#284)
amannn May 10, 2023
e249b82
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc-reba…
amannn May 10, 2023
918a7a4
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn May 11, 2023
72f37b6
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn May 12, 2023
46b0122
Add workaround to example-next-13-advanced to enable soft navigation …
amannn May 15, 2023
fa98d0f
Improve error message for calling hooks in async components
amannn May 15, 2023
d490c28
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn May 22, 2023
4b61c06
feat(RSC): Add support for `redirect` in Client Components
amannn May 25, 2023
a325557
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc-redi…
amannn May 25, 2023
2dff0b6
Fix tests
amannn May 25, 2023
b483109
Disable test for now [skip ci]
amannn May 25, 2023
5d1ac85
feat(RSC): Add support for `redirect` in Client Components (#308)
amannn May 25, 2023
8523dba
Make config passed to plugin optional
amannn May 27, 2023
017fd93
feat(RSC): Add CDN caching patch (#311)
amannn May 27, 2023
6e95b4b
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn May 27, 2023
04bd7bd
Move patch
amannn May 27, 2023
335afcf
Remove patch
amannn May 27, 2023
b219e13
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Jun 20, 2023
808acab
Fix error when no config is provided
amannn Jun 20, 2023
0f3116b
feat: New APIs for using `next-intl` outside of components (#339)
amannn Jun 22, 2023
b405e61
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Jun 22, 2023
26f8d19
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Jun 23, 2023
873dc59
refactor: Switch to a string argument for the `locale` that is passed…
amannn Jun 23, 2023
16c8388
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Jun 29, 2023
bdbb558
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Jun 29, 2023
e6b3efb
Fix lockfile
amannn Jun 29, 2023
ca0cfe7
Fix TS
amannn Jun 29, 2023
cae306a
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Jun 30, 2023
3071d01
Update lockfile
amannn Jun 30, 2023
14aa6e8
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Jun 30, 2023
25c747a
Add retries for tests (Chrome dies occasionally)
amannn Jun 30, 2023
6f601a5
chore(Next.js 13 RSC): Switch to tsup for bundling
amannn Jun 30, 2023
e4b2275
Revert "chore(Next.js 13 RSC): Switch to tsup for bundling"
amannn Jun 30, 2023
fd1587b
Fix types when importing from `next-intl/server` with `moduleResoluti…
amannn Jun 30, 2023
4e7766b
chore(Next.js 13 RSC): Switch to `tsup` for bundling and `vitest` for…
amannn Jul 3, 2023
9c9bc8d
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Jul 4, 2023
1d66aec
Update links to docs
amannn Jul 4, 2023
4d5ee43
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Jul 4, 2023
7fa1424
Update lockfile
amannn Jul 4, 2023
7a6e0a6
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Jul 5, 2023
8a3946c
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Jul 5, 2023
41900d7
chore: Rebase RSC on `main` (#385)
amannn Jul 7, 2023
610c665
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Jul 11, 2023
22fe5d9
Upgrade TypeScript for new examples
amannn Jul 11, 2023
b423baa
fix(RSC): Return `string` from `(await getTranslator()).rich` (#395)
amannn Jul 11, 2023
add3e94
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Jul 17, 2023
f0ae6ce
Opengraph example
amannn Jul 19, 2023
e8ece99
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Jul 19, 2023
2c7ac92
Fix tests
amannn Jul 19, 2023
a371d39
refactor(RSC): Clean up package boundaries (#387)
amannn Jul 26, 2023
a2f3553
Use built-in RSC serialization for `now`
amannn Jul 26, 2023
4297a19
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Aug 24, 2023
dbc06d1
Fix lint
amannn Aug 24, 2023
e343ce0
Fix test
amannn Aug 24, 2023
f408d92
feat: Add built-in pathname localization (#426)
amannn Aug 25, 2023
0197a6f
Publish `navigation.d.ts`
amannn Aug 28, 2023
d4eee0d
Don't require `i18n.ts` for `next start`
amannn Aug 29, 2023
0e7835b
Fix return type of plugin
amannn Aug 29, 2023
e475cb2
feat(RSC): Optimize bundle size (#489)
amannn Sep 1, 2023
3481a59
fix: Allow unknown routes in localized pathnames navigation APIs (#493)
jlalmes Sep 5, 2023
ab48fd2
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Sep 7, 2023
37c131b
fix(RSC): Always read header in RSC render (#506)
amannn Sep 14, 2023
6c8eb13
Improve error handling when calling `redirect` on the client side
amannn Sep 15, 2023
0a089b8
Add comment why we don't provide a default `locale` for `NextIntlClie…
amannn Sep 15, 2023
0aa60ad
Increase bundle threshold
amannn Sep 15, 2023
106c098
feat(RSC): Better error handling for missing context (#508)
amannn Sep 15, 2023
50cd7ee
feat(RSC): Add `getPathname` for localized navigation (#510)
amannn Sep 18, 2023
7358907
docs(RSC): Update Next.js to 13.5.1 (#512)
amannn Sep 20, 2023
6836f20
feat(RSC): Experimental SSG (#509)
amannn Sep 21, 2023
3f85ffa
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Sep 21, 2023
975a1c0
Fix docs build
amannn Sep 21, 2023
b732305
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Sep 21, 2023
2bf4aef
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Sep 22, 2023
5a2b503
Increase size limit
amannn Sep 22, 2023
9697c3c
feat(RSC): Add defaults for `locale`, `now` and `timeZone` for `NextI…
amannn Sep 22, 2023
4f93607
fix(RSC): Remove pages router import and require explicit `locale` wh…
amannn Sep 22, 2023
54ddd45
Remove outdated named routes example
amannn Sep 22, 2023
d98a549
Update error message for static rendering
amannn Sep 25, 2023
38252e7
Upgrade to [email protected]
amannn Sep 25, 2023
ee25914
Improve error when middleware didn't match the request
amannn Sep 25, 2023
549dc17
feat(RSC): Remove deprecations and RSC-first docs (#522)
amannn Sep 28, 2023
4c42f52
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Sep 28, 2023
6bafe4e
Improve error handling docs
amannn Sep 28, 2023
e98e181
as-necessary -> as-needed
amannn Sep 28, 2023
07f8186
Add deep dive about RSC implementation
amannn Sep 28, 2023
a463263
Add note about how unstable_setRequestLocale works
amannn Sep 29, 2023
65d9212
Remove mentions of `createServerContext`
amannn Oct 1, 2023
efb5046
Improve hint in regard to `error.tsx`
amannn Oct 2, 2023
5c1bac3
Add note about when to call `unstable_setRequestLocale`
amannn Oct 3, 2023
214d8e7
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Oct 9, 2023
7f6365a
Fix redirect for requests for the default locale when prefixed at the…
amannn Oct 9, 2023
d133fd6
Update issue commenter template [skip ci]
amannn Oct 9, 2023
7582d4c
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Oct 9, 2023
2b7a0d6
Use non-nullable return type for `useMessages` by throwing if there a…
amannn Oct 9, 2023
631d12d
Update sizes
amannn Oct 9, 2023
fb80bd1
Clarify browser support
amannn Oct 10, 2023
c037a40
Fix tests
amannn Oct 10, 2023
fc4101b
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Oct 11, 2023
defa4b2
Remove more deprecations
amannn Oct 14, 2023
dbec9f3
Improve error message for missing context due to latest changes from …
amannn Oct 14, 2023
3522b43
Update tests
amannn Oct 15, 2023
7fd084f
Leave error messages in server-only code after production build, remo…
amannn Oct 16, 2023
d1b398d
fix(RSC): Fixed the search not being added on localized pathname redi…
BrendonSled Oct 18, 2023
1b2ed7d
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Oct 18, 2023
7f54ec2
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Oct 19, 2023
581c16b
feat(RSC): Add `t.markup` and unify function signature of `t.rich` (#…
amannn Oct 19, 2023
371203b
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Oct 19, 2023
f050808
Improve docs for missing middleware
amannn Oct 19, 2023
61b2bce
fix(RSC): Use `webpackConfig.context` instead of `process.cwd()` to d…
amannn Oct 25, 2023
0bcca2d
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Nov 2, 2023
ccf3810
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Nov 2, 2023
064c692
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Nov 3, 2023
49fce7c
Add note about localizing pathnames with a CMS [skip ci]
amannn Nov 3, 2023
633e07d
refactor(RSC): Refactor async APIs to make the locale optional (#600)
amannn Nov 7, 2023
abf54c3
fix(RSC): RSC bug fixes (#604)
amannn Nov 7, 2023
47d7c16
Latest RC
amannn Nov 7, 2023
59bdea3
Update docs:
amannn Nov 7, 2023
fd4b6a5
docs(RSC): Add Server Actions demo (#606)
amannn Nov 8, 2023
78bdcaa
docs: Add note on `force-static`
amannn Nov 8, 2023
e8c9818
docs: Fix typos, include more background info on `unstable_setRequest…
amannn Nov 9, 2023
286c96c
fix(RSC): Fix type of `namespace` in `getTranslations` (#616)
amannn Nov 9, 2023
3d2ccc1
Merge remote-tracking branch 'origin/main' into feat/next-13-rsc
amannn Nov 9, 2023
763c69a
Remove unused import in docs
amannn Nov 9, 2023
4c5e5aa
docs: Add links for dynamic rendering
amannn Nov 9, 2023
1b21dbf
Update banner and blog post
amannn Nov 10, 2023
f63bbfc
Add meta description and title for twitter
amannn Nov 10, 2023
e17b9db
Fix link
amannn Nov 10, 2023
2c88df3
docs: Add example for additional rewrites in middleware
amannn Nov 12, 2023
a0a1f04
Avoid re-rendering of context consumers if possible
amannn Nov 13, 2023
f542802
docs: Sync pathnames tabs in docs
amannn Nov 14, 2023
c7b2626
docs: Various fixes
amannn Nov 14, 2023
2ccb247
feat(RSC): Various fixes (#623)
amannn Nov 14, 2023
1603a34
Update blog post
amannn Nov 14, 2023
acf9698
docs: Update links
amannn Nov 14, 2023
b65d5d8
Merge branch 'feat/next-13-rsc-v3_final_FINAL' into feat/next-13-rsc
amannn Nov 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
- run: yarn workspace example run build
- run: yarn workspace example-advanced run build
- run: yarn workspace example-next-13 run build
- run: yarn workspace example-next-13-advanced run build
- run: yarn workspace example-next-13-named-routes run build
- run: yarn workspace example-next-13-with-pages run build

- run: yarn workspaces run lint
- run: yarn workspaces run test
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
registry-url: 'https://registry.npmjs.org'
- uses: bahmutov/npm-install@v1
# Seems like after squash & merge the author is unknown to lerna
- run: git config --global user.email "jan@amann.me" && git config --global user.name "Jan Amann"
- run: git config --global user.email "jan@amann.work" && git config --global user.name "Jan Amann"
- run: yarn run publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 3 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"packages/example",
"packages/example-advanced",
"packages/example-next-13",
"packages/example-next-13-advanced",
"packages/example-next-13-named-routes",
"packages/example-next-13-with-pages",
"packages/website"
],
"useWorkspaces": true,
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"packages/next-intl",
"packages/example",
"packages/example-next-13",
"packages/example-next-13-advanced",
"packages/example-next-13-named-routes",
"packages/example-next-13-with-pages",
"packages/example-advanced",
"packages/website"
],
Expand Down
4 changes: 2 additions & 2 deletions packages/example-advanced/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"next": "^13.0.0",
"next-intl": "^2.11.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^4.6.3"
"react-dom": "^18.2.0"
},
"devDependencies": {
"typescript": "^4.6.3",
"@testing-library/react": "^13.0.0",
"@types/accept-language-parser": "^1.5.3",
"@types/lodash": "^4.14.176",
Expand Down
2 changes: 1 addition & 1 deletion packages/example-advanced/src/pages/api/hello.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default async function handler(
namespace: 'Index'
});

// Creates the same object that is returned by `useIntl`.
// Creates the same object that is returned by `useFormatter`.
const format = createFormatter({locale});

res.status(200).json({
Expand Down
15 changes: 15 additions & 0 deletions packages/example-next-13-advanced/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require('eslint-config-molindo/setupPlugins');

module.exports = {
env: {
node: true
},
extends: [
'molindo/typescript',
'molindo/react',
'plugin:@next/next/recommended'
],
rules: {
'react/react-in-jsx-scope': 'off'
}
};
4 changes: 4 additions & 0 deletions packages/example-next-13-advanced/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/node_modules
/.next/
.DS_Store
tsconfig.tsbuildinfo
4 changes: 4 additions & 0 deletions packages/example-next-13-advanced/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"typescript.tsdk": "../../node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
3 changes: 3 additions & 0 deletions packages/example-next-13-advanced/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# example-next-13-advanced

An example that showcases usage of `next-intl` in the `app` folder of Next.js 13.
3 changes: 3 additions & 0 deletions packages/example-next-13-advanced/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Declaring this interface provides type safety for message keys
type Messages = typeof import('./messages/en.json');
declare interface IntlMessages extends Messages {}
42 changes: 42 additions & 0 deletions packages/example-next-13-advanced/messages/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"Index": {
"title": "Start",
"description": "Das ist die Startseite.",
"rich": "Das ist <important>formatierter</important> Test.",
"globalDefaults": "<highlight>{globalString}</highlight>"
},
"LocaleLayout": {
"title": "next-intl Beispiel",
"description": "Das ist ein Beispiel, wie next-intl im `app`-Verzeichnis verwendet werden kann."
},
"Client": {
"title": "Client",
"description": "Dise Seite wird auf der Client-Seite initialisiert."
},
"Nested": {
"title": "Verschachtelt",
"description": "Das ist eine verschachtelte Seite."
},
"Navigation": {
"home": "Start",
"client": "Client-Seite",
"nested": "Verschachtelte Seite"
},
"NotFound": {
"title": "Diese Seite wurde nicht gefunden (404)"
},
"LocaleSwitcher": {
"switchLocale": "Zu {locale, select, de {Deutsch} en {Englisch} other {Unbekannt}} wechseln"
},
"Counter": {
"count": "Aktuell:",
"increment": "Erhöhen"
},
"ClientCounter": {
"count": "Aktuell: {count}",
"increment": "Erhöhen"
},
"ApiRoute": {
"hello": "Hallo {name}!"
}
}
42 changes: 42 additions & 0 deletions packages/example-next-13-advanced/messages/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"Index": {
"title": "Home",
"description": "This is the home page.",
"rich": "This is a <important>rich</important> text.",
"globalDefaults": "<highlight>{globalString}</highlight>"
},
"LocaleLayout": {
"title": "next-intl example",
"description": "This is an example of using next-intl in the `app` directory."
},
"Client": {
"title": "Client",
"description": "This page hydrates on the client side."
},
"Nested": {
"title": "Nested",
"description": "This is a nested page."
},
"Navigation": {
"home": "Home",
"client": "Client page",
"nested": "Nested page"
},
"NotFound": {
"title": "This page was not found (404)"
},
"LocaleSwitcher": {
"switchLocale": "Switch to {locale, select, de {German} en {English} other {Unknown}}"
},
"Counter": {
"count": "Current count:",
"increment": "Increment"
},
"ClientCounter": {
"count": "Current count: {count}",
"increment": "Increment"
},
"ApiRoute": {
"hello": "Hello {name}!"
}
}
42 changes: 42 additions & 0 deletions packages/example-next-13-advanced/messages/es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"Index": {
"title": "Inicio",
"description": "Esta es la página de inicio.",
"rich": "Este es un texto <important>importante</important>.",
"globalDefaults": "<highlight>{globalString}</highlight>"
},
"LocaleLayout": {
"title": "Ejemplo next-intl",
"description": "Este es un ejemplo de cómo usar next-intl en el directorio app."
},
"Client": {
"title": "Cliente",
"description": "Esta página se hidrata en el lado del cliente."
},
"Nested": {
"title": "Anidada",
"description": "Esta es una página anidada."
},
"Navigation": {
"home": "Inicio",
"client": "Página del cliente",
"nested": "Página anidada"
},
"NotFound": {
"title": "Esta página no se encontró (404)"
},
"LocaleSwitcher": {
"switchLocale": "Cambiar a {locale, select, de {Alemán} en {Inglés} other {Desconocido}}"
},
"Counter": {
"count": "Conteo actual:",
"increment": "Incrementar"
},
"ClientCounter": {
"count": "Conteo actual: {count}",
"increment": "Incrementar"
},
"ApiRoute": {
"hello": "¡Hola {name}!"
}
}
5 changes: 5 additions & 0 deletions packages/example-next-13-advanced/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
40 changes: 40 additions & 0 deletions packages/example-next-13-advanced/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const ms = require('ms');
const withNextIntl = require('next-intl/plugin')();

module.exports = withNextIntl({
experimental: {appDir: true},
rewrites() {
return [
{
source: '/de/verschachtelt',
destination: '/de/nested'
},
{
source: '/es/anidada',
destination: '/es/nested'
}
];
},
headers() {
return [
{
source: '/((?!_next|assets|favicon.ico).*)',
missing: [
{
type: 'header',
key: 'Next-Router-Prefetch'
}
],
headers: [
{
key: 'Cache-Control',
value: [
`s-maxage=` + ms('1d') / 1000,
`stale-while-revalidate=` + ms('1y') / 1000
].join(', ')
}
]
}
];
}
});
32 changes: 32 additions & 0 deletions packages/example-next-13-advanced/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "example-next-13-advanced",
"version": "2.9.1",
"private": true,
"scripts": {
"dev": "next dev",
"lint": "eslint src && tsc",
"test": "playwright test",
"test:watch": "chokidar 'tests/main.spec.ts' -c 'npm run test'",
"build": "next build",
"start": "next start"
},
"dependencies": {
"lodash": "^4.17.21",
"ms": "2.1.3",
"next": "13.2.4",
"next-intl": "*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"typescript": "^4.6.3",
"@playwright/test": "^1.29.0",
"@types/lodash": "^4.14.176",
"@types/node": "^17.0.23",
"@types/react": "^18.0.23",
"chokidar-cli": "3.0.0",
"eslint": "^8.12.0",
"eslint-config-molindo": "^6.0.0",
"eslint-config-next": "^13.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const config: PlaywrightTestConfig = {
}
],
webServer: {
reuseExistingServer: true,
command: 'yarn start',
port: 3000
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {notFound} from 'next/navigation';

export default function CatchAll() {
// `not-found` currently only renders when triggered by the `notFound` function
// https://beta.nextjs.org/docs/api-reference/file-conventions/not-found
notFound();

return null;
}
12 changes: 12 additions & 0 deletions packages/example-next-13-advanced/src/app/[locale]/api/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {getTranslations} from 'next-intl/server';
import {NextRequest, NextResponse} from 'next/server';

export async function GET(request: NextRequest) {
const name = request.nextUrl.searchParams.get('name');
if (!name) {
return new Response('Search param `name` was not provided.', {status: 400});
}

const t = await getTranslations('ApiRoute');
return NextResponse.json({message: t('hello', {name})});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use client';

import {useNow, Link} from 'next-intl';
import {usePathname} from 'next-intl/client';

export default function ClientContent() {
const now = useNow();

return (
<>
<p data-testid="NowFromClient">{now.toISOString()}</p>
<Link href="/">Go to home</Link>
<p data-testid="UnlocalizedPathname">{usePathname()}</p>
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {useNow} from 'next-intl';
import {use} from 'react';

export default function DelayedServerContent() {
use(new Promise((resolve) => setTimeout(resolve, 50)));
const now = useNow();

return (
<>
<p data-testid="NowFromServerDelayed">{now.toISOString()}</p>
</>
);
}
26 changes: 26 additions & 0 deletions packages/example-next-13-advanced/src/app/[locale]/client/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {
useTranslations,
useLocale,
useNow,
NextIntlClientProvider
} from 'next-intl';
import PageLayout from '../../../components/PageLayout';
import ClientContent from './ClientContent';
import DelayedServerContent from './DelayedServerContent';

export default function Client() {
const t = useTranslations('Client');
const locale = useLocale();
const now = useNow();

return (
<PageLayout title={t('title')}>
<p>{t('description')}</p>
<p data-testid="NowFromServer">{now.toISOString()}</p>
<DelayedServerContent />
<NextIntlClientProvider locale={locale} now={now.toISOString()}>
<ClientContent />
</NextIntlClientProvider>
</PageLayout>
);
}
Loading