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 250 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
5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ body:
label: Mandatory reproduction URL (CodeSandbox or GitHub repository)
description: |
**Templates:**
- [CodeSandbox (`app` directory)](https://codesandbox.io/p/sandbox/next-intl-bug-template-forked-yow8ep)
- [CodeSandbox (`app` directory, RSC RC)](https://codesandbox.io/p/sandbox/next-intl-bug-template-app-forked-zcymvq)
- [CodeSandbox (`pages` directory)](https://codesandbox.io/p/sandbox/next-intl-bug-template-pages-krm37f)
- [CodeSandbox (App Router)](https://codesandbox.io/p/sandbox/next-intl-bug-template-app-forked-zcymvq)
- [CodeSandbox (Pages Router)](https://codesandbox.io/p/sandbox/next-intl-bug-template-pages-krm37f)
validations:
required: true
- type: textarea
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/issue-commenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ jobs:
Unfortunately, the reproduction is missing or incomplete, and as such we cannot investigate this issue. Please add a reproduction to the issue, otherwise it will be closed automatically.

**Templates:**
- [CodeSandbox (`app` directory)](https://codesandbox.io/p/sandbox/next-intl-bug-template-forked-yow8ep)
- [CodeSandbox (`app` directory, RSC RC)](https://codesandbox.io/p/sandbox/next-intl-bug-template-app-forked-zcymvq)
- [CodeSandbox (`pages` directory)](https://codesandbox.io/p/sandbox/next-intl-bug-template-pages-krm37f)
- [CodeSandbox (App Router)](https://codesandbox.io/p/sandbox/next-intl-bug-template-app-forked-zcymvq)
- [CodeSandbox (Pages Router)](https://codesandbox.io/p/sandbox/next-intl-bug-template-pages-krm37f)

**Creating a good bug report takes time.**

Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ jobs:
cache: 'pnpm'
- run: pnpm install

# Next.js caching
- uses: actions/cache@v3
with:
path: ${{ github.workspace }}/examples/*/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}

# Playwright
- run: |
PLAYWRIGHT_VERSION=$(cat pnpm-lock.yaml | grep /@playwright/test@ | sed 's/.*@\([^:]*\):.*/\1/')
Expand All @@ -32,7 +38,7 @@ jobs:
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}
- if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
# Setting up playwright in one example is sufficient
run: pnpm --filter example-next-13 exec playwright install --with-deps
run: pnpm --filter example-next-13-advanced exec playwright install --with-deps

- run: pnpm run build
- run: pnpm run lint
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function UserProfile({user}) {
}
```

```json
```js
// en.json
{
"UserProfile": {
Expand Down
2 changes: 1 addition & 1 deletion docs/components/CodeSnippets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function icu() {
<span style={{color: 'var(--shiki-token-punctuation)'}}>:</span>
<span style={{color: 'var(--shiki-color-text)'}}> </span>
<span style={{color: 'var(--shiki-token-string-expression)'}}>
"{'{'}username{'}'}'s profile"
"{'{'}firstName{'}'}'s profile"
</span>
<span style={{color: 'var(--shiki-token-punctuation)'}}>,</span>
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function Hero({
</div>
<Link
className="mt-10 inline-flex border border-green-300/50 px-4 py-2 font-semibold text-green-300 transition-colors hover:border-white/50 hover:text-white lg:mt-20"
href="/docs"
href="/docs/getting-started/app-router"
>
<span className="mr-3 inline-block">📣</span>{' '}
<span>{rscAnnouncement}</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/components/HeroCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ const files = [
<span style={{color: 'var(--shiki-token-punctuation)'}}>:</span>
<span style={{color: 'var(--shiki-color-text)'}}> </span>
<span style={{color: 'var(--shiki-token-string-expression)'}}>
"{'{'}username{'}'}'s profile"
"{'{'}firstname{'}'}'s profile"
</span>
<span style={{color: 'var(--shiki-token-punctuation)'}}>,</span>
</span>
Expand Down
31 changes: 0 additions & 31 deletions docs/components/VersionTabs.tsx

This file was deleted.

34 changes: 22 additions & 12 deletions docs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,17 @@ module.exports = withNextra({
},
{
source: '/docs/getting-started/production-checklist',
destination: '/docs/production-checklist',
destination: '/docs/environments/runtime-requirements',
permanent: true
},
{
source: '/docs/usage/production-checklist',
destination: '/docs/production-checklist',
destination: '/docs/environments/runtime-requirements',
permanent: true
},
{
source: '/docs/production-checklist',
destination: '/docs/environments/runtime-requirements',
permanent: true
},
{
Expand All @@ -45,12 +50,22 @@ module.exports = withNextra({
},
{
source: '/docs/next-13/client-components',
destination: '/docs/getting-started/app-router-client-components',
destination: '/docs/getting-started/app-router',
permanent: true
},
{
source: '/docs/next-13/server-components',
destination: '/docs/getting-started/app-router-server-components',
destination: '/docs/getting-started/app-router',
permanent: true
},
{
source: '/docs/getting-started/app-router-server-components',
destination: '/docs/getting-started/app-router',
permanent: true
},
{
source: '/docs/getting-started/app-router-client-components',
destination: '/docs/getting-started/app-router',
permanent: true
},
{
Expand All @@ -75,22 +90,17 @@ module.exports = withNextra({
},
{
source: '/docs/usage/production-checklist',
destination: '/docs/production-checklist',
destination: '/docs/environments/runtime-requirements',
permanent: true
},
{
source: '/docs/usage/runtime-requirements-polyfills',
destination: '/docs/production-checklist#runtime-requirements',
permanent: true
},
{
source: '/docs/usage/configuration',
destination: '/docs/configuration',
destination: '/docs/environments/runtime-requirements',
permanent: true
},
{
source: '/docs/usage/error-handling',
destination: '/docs/configuration#error-handling',
destination: '/docs/usage/configuration#error-handling',
permanent: true
},
{
Expand Down
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
"tailwindcss": "^3.3.2"
},
"devDependencies": {
"@types/node": "20.1.2",
"@types/react": "^18.2.5",
"@types/node": "^20.1.2",
"@types/react": "^18.2.29",
"autoprefixer": "^10.4.0",
"eslint": "^8.46.0",
"eslint-config-molindo": "^7.0.0",
"eslint-config-next": "^13.4.0",
"next-sitemap": "^4.0.7",
"typescript": "^5.0.0"
"typescript": "^5.2.2"
},
"funding": "https://github.com/amannn/next-intl?sponsor=1"
}
2 changes: 1 addition & 1 deletion docs/pages/blog/next-intl-3-0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Note that if you're using `next-intl` exclusively in Client Components, this doe
5. `next@^13.4` is now required for the RSC APIs. Next.js 12 is still supported for the Pages Router integration.
6. If you're using `NextIntlClientProvider` outside of the App Router (e.g. with the Pages Router), you need to define the `locale` prop explicitly.
7. `useMessages` now has a non-nullable return type for easier consumption and will throw if no messages are configured.
8. `createTranslator(…).rich` now returns a `ReactNode`. Previously, this was somewhat confusing, since `t.rich` accepted and returned either React elements or strings depending on if you retrieve the fuction via `useTranslations` or `createTranslator`. Now, an explicit [`t.markup`](https://next-intl-docs-git-feat-next-13-rsc-next-intl.vercel.app/docs/usage/messages#html-markup) function has been added to generate markup strings like `'<b>Hello</b>'` outside of React components.
8. `createTranslator(…).rich` now returns a `ReactNode`. Previously, this was somewhat confusing, since `t.rich` accepted and returned either React elements or strings depending on if you retrieve the fuction via `useTranslations` or `createTranslator`. Now, an explicit [`t.markup`](/docs/usage/messages#html-markup) function has been added to generate markup strings like `'<b>Hello</b>'` outside of React components.
9. `useIntl` has been replaced with [`useFormatter`](https://next-intl-docs-git-feat-next-13-rsc-next-intl.vercel.app/docs/usage/dates-times) (deprecated since v2.11).
10. `createIntl` has been replaced with [`createFormatter`](https://next-intl-docs-git-feat-next-13-rsc-next-intl.vercel.app/docs/environments/core-library) (deprecated since v2.11).

Expand Down
15 changes: 5 additions & 10 deletions docs/pages/blog/translations-outside-of-react-components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,21 @@ Additionally, this approach is more robust to possibly unexpected states, like t

If you’re working with Next.js, you might want to translate i18n messages in [API routes](https://nextjs.org/docs/pages/building-your-application/routing/api-routes), [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/router-handlers) or the [Metadata API](https://nextjs.org/docs/app/api-reference/file-conventions/metadata).

`next-intl` provides a [core library](/docs/environments/core-library) that is agnostic from React and can be used for these cases.
`next-intl/server` provides a set of awaitable versions of the functions that you usually call as hooks from within components. These are agnostic from React and can be used for these cases.

```tsx
import {createTranslator} from 'next-intl';
import {getTranslations} from 'next-intl/server';

const messages = {
hello: 'Hello {name}!'
};
// The `locale` is received from Next.js via `params`
const locale = params.locale;

// This creates the same function that is returned by `useTranslations`.
// Since there's no provider, you can pass all the properties you'd
// usually pass to the provider directly here.
const t = createTranslator({locale: 'en', messages});
const t = await getTranslations(locale);

// Result: "Hello world!"
t('hello', {name: 'world'});
```

There's currently a proposal to further simplify this use case, by offering a set of [new APIs that integrate with Server Components](/docs/environments/metadata-route-handlers) (currently in beta).

## This seems familiar

If you’ve been working with React for a longer time, you might have experienced the change [from `component{DidMount,DidUpdate,WillUnmount}` to `useEffect`](https://legacy.reactjs.org/docs/hooks-effect.html#explanation-why-effects-run-on-each-update). The reason why `useEffect` is superior is because it nudges the developer into a direction where the app is always in sync and by doing this, a whole array of potential issues just magically disappear.
Expand Down
2 changes: 0 additions & 2 deletions docs/pages/docs/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
"getting-started": "Getting started",
"usage": "Usage guide",
"environments": "Environments",
"configuration": "Global configuration",
"routing": "Routing",
"workflows": "Workflows & integrations",
"production-checklist": "Production checklist",
"faq": "FAQ"
}
3 changes: 2 additions & 1 deletion docs/pages/docs/environments/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"server-client-components": "Server & Client Components",
"metadata-route-handlers": "Metadata & Route Handlers",
"error-files": "Error files (e.g. not-found)",
"core-library": "Core library"
"core-library": "Core library",
"runtime-requirements": "Runtime requirements"
}
8 changes: 4 additions & 4 deletions docs/pages/docs/environments/core-library.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ const t = createTranslator({locale: 'en', messages});
// Result: "Hello world!"
t('basic', {name: 'world'});

// Rich text uses functions that accept and return a string.
// Result: "Hello <b>world</b>!"
t.rich('rich', {
// To generate HTML markup, you can consider using the `markup`
// function which in contrast to `t.rich` returns a markup string.
t.markup('rich', {
name: 'world',
b: (chunks) => `<b>${chunks}</b>`
});
```

For date, time and number formatting, the `intl` object can be created outside of React as well:
For date, time and number formatting, the `format` object can be created outside of React as well:

```js
import {createFormatter} from 'next-intl';
Expand Down
52 changes: 21 additions & 31 deletions docs/pages/docs/environments/error-files.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import VersionTabs from 'components/VersionTabs';
import Callout from 'components/Callout';

# Internationalization in Next.js error files
Expand Down Expand Up @@ -53,24 +52,19 @@ You can add a root `not-found` page to handle these cases too.
```tsx filename="app/not-found.tsx"
'use client';

import Error from 'next/error';
import {redirect, usePathname} from 'next/navigation';

// Render the default Next.js 404 page when a route
// is requested that doesn't match the middleware and
// therefore doesn't have a locale associated with it.
const defaultLocale = 'en';

export default function NotFound() {
return (
<html lang="en">
<body>
<Error statusCode={404} />
</body>
</html>
);
const pathname = usePathname();

// Add a locale prefix to show a localized not found page
redirect(`/${defaultLocale}${pathname}`);
}
```

Note that the presence of `app/not-found.tsx` requires that a root layout is available as well, even if it's just passing `children` through.
Note that the presence of `app/not-found.tsx` requires that a root layout is available, even if it's just passing `children` through.

```tsx filename="app/layout.tsx"
// Since we have a root `not-found.tsx` page, a layout file
Expand All @@ -89,12 +83,8 @@ import {notFound} from 'next/navigation';
const locales = ['en', 'de'];

export default function LocaleLayout({children, params}) {
const locale = useLocale();

// Validate that the incoming `locale` parameter is a valid locale
if (params.locale !== locale) {
notFound();
}
// Validate that the incoming `locale` parameter is valid
if (!locales.includes(locale as any)) notFound();

return (
<html lang={locale}>
Expand Down Expand Up @@ -125,11 +115,7 @@ When an `error` file is defined, Next.js creates [an error boundary within your

</figure>

Since the `error` file must be defined as a Client Component, you have to use [`NextIntlClientProvider`](/docs/configuration#client-server-components) to provide messages in case the `error` file renders.

If you've [set up `next-intl` to be used in Client Components](/docs/getting-started/app-router-client-components), this is already the case and there's no additional setup needed. If you're using [the Server Components beta](/docs/getting-started/app-router-server-components) though, you have to provide the relevant messages in the wrapping layout.

<figure>
Since the `error` file must be defined as a Client Component, you have to use [`NextIntlClientProvider`](/docs/usage/configuration#nextintlclientprovider) to provide messages in case the `error` file renders.

```tsx filename="app/[locale]/layout.tsx"
import pick from 'lodash/pick';
Expand All @@ -153,13 +139,6 @@ export default async function LocaleLayout({children}) {
}
```

<figcaption>
Providing messages for the `error` file is only necessary when using [the
Server Components beta](/docs/getting-started/app-router-server-components).
</figcaption>

</figure>

Once `NextIntlClientProvider` is in place, you can use functionality from `next-intl` in the `error` file:

```tsx filename="app/[locale]/error.tsx"
Expand All @@ -178,3 +157,14 @@ export default function Error({error, reset}) {
);
}
```

Note that `error.tsx` is loaded as soon as the app starts. If your app is performance-senstive and you want to avoid loading translation functionality from `next-intl` as part of the initial bundle, you can export a lazy reference from your `error` file:

```tsx filename="app/[locale]/error.tsx"
'use client';

import {lazy} from 'react';

// Move error content to a separate chunk and load it only when needed
export default lazy(() => import('./Error'));
```
2 changes: 2 additions & 0 deletions docs/pages/docs/environments/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ The `next-intl` APIs are available in the following environments:
href="/docs/environments/core-library"
/>
</div>

While modern browsers and server runtimes typically support all necessary JavaScript APIs that are required for `next-intl`, you can double check [the runtime requirements](/docs/environments/runtime-requirements).
Loading
Loading