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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,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
3 changes: 1 addition & 2 deletions docs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
require('eslint-config-molindo/setupPlugins');

module.exports = {
extends: [
'molindo/typescript',
'molindo/react',
'molindo/tailwind',
'plugin:@next/next/recommended'
],
env: {
Expand Down
2 changes: 1 addition & 1 deletion docs/components/Callout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function Callout({
)}
>
<div
className="select-none text-xl ltr:pl-3 ltr:pr-2 rtl:pr-3 rtl:pl-2"
className="select-none text-xl ltr:pl-3 ltr:pr-2 rtl:pl-2 rtl:pr-3"
style={{
fontFamily: '"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'
}}
Expand Down
4 changes: 2 additions & 2 deletions docs/components/CodeSnippets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ function typeSafe() {
style={{color: 'var(--shiki-token-string-expression)'}}
>
{"''"}
<div className="absolute top-0 left-2 h-full border-l-[1.5px] border-slate-400" />
<div className="absolute top-[calc(100%+2px)] left-2 min-w-[8rem] rounded-sm border border-slate-300 bg-slate-100 text-slate-900 dark:border-slate-700 dark:bg-slate-800 dark:text-white">
<div className="absolute left-2 top-0 h-full border-l-[1.5px] border-slate-400" />
<div className="absolute left-2 top-[calc(100%+2px)] min-w-[8rem] rounded-sm border border-slate-300 bg-slate-100 text-slate-900 dark:border-slate-700 dark:bg-slate-800 dark:text-white">
<div className="bg-sky-100 p-1 dark:bg-slate-600">title</div>
<div className="p-1">followers</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/components/CommunityLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function CommunityLink({
<div className="mt-2">
{type && (
<Chip
className="mr-2 -translate-y-[1px]"
className="mr-2 translate-y-[-1px]"
color={({article: 'green', video: 'yellow'} as const)[type]}
>
{{article: 'Article', video: 'Video'}[type]}
Expand Down
2 changes: 1 addition & 1 deletion docs/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function Footer() {

return (
<div className="border-t border-slate-200 bg-slate-100 dark:border-t-slate-800 dark:bg-transparent">
<div className="mx-auto max-w-[90rem] py-2 px-4 md:flex md:justify-between ">
<div className="mx-auto max-w-[90rem] px-4 py-2 md:flex md:justify-between ">
<div>
<FooterLink href="/docs">Docs</FooterLink>
<FooterSeparator />
Expand Down
4 changes: 2 additions & 2 deletions docs/components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export default function Hero({
}: Props) {
return (
<div className="dark overflow-hidden">
<div className="relative max-w-full overflow-hidden bg-slate-850 py-16 sm:px-2 lg:py-40 lg:px-0">
<div className="absolute top-0 left-0 h-[20500px] w-[20500px] -translate-x-[47.5%] rounded-full bg-gradient-to-b from-slate-900 via-cyan-500 md:top-1" />
<div className="relative max-w-full overflow-hidden bg-slate-850 py-16 sm:px-2 lg:px-0 lg:py-40">
<div className="absolute left-0 top-0 h-[20500px] w-[20500px] translate-x-[-47.5%] rounded-full bg-gradient-to-b from-slate-900 via-cyan-500 md:top-1" />
<Wrapper>
<div className="flex flex-col gap-16 xl:flex-row xl:items-center xl:justify-between">
<div className="max-w-2xl">
Expand Down
2 changes: 1 addition & 1 deletion docs/components/HeroCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function Tab({
className={clsx(
'flex items-center rounded-md px-4 py-2 text-sm font-medium transition-colors',
active
? 'bg-slate-800 text-sky-100/70 text-white'
? 'bg-slate-800 text-white'
: 'bg-slate-800/40 text-slate-500 hover:bg-slate-800'
)}
onClick={onClick}
Expand Down
2 changes: 1 addition & 1 deletion docs/components/LinkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function LinkButton({variant = 'primary', ...rest}: Props) {
return (
<Link
className={clsx(
'inline-block rounded-full py-2 px-4 text-base font-semibold transition-colors lg:py-4 lg:px-8',
'inline-block rounded-full px-4 py-2 text-base font-semibold transition-colors lg:px-8 lg:py-4',
variant === 'primary'
? 'bg-slate-800 text-white hover:bg-slate-700 dark:bg-primary dark:text-slate-900 dark:hover:bg-sky-200'
: 'bg-slate-200 text-slate-700 dark:bg-slate-800 dark:text-white/90 dark:hover:bg-slate-700'
Expand Down
8 changes: 4 additions & 4 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
"nextra-theme-docs": "^2.8.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tailwindcss": "^3.2.4"
"tailwindcss": "^3.3.2"
},
"devDependencies": {
"@types/node": "20.1.2",
"@types/node": "^20.1.2",
"@types/react": "^18.2.5",
"autoprefixer": "^10.4.0",
"eslint": "^8.39.0",
"eslint-config-molindo": "^6.0.0",
"eslint": "^8.46.0",
"eslint-config-molindo": "7.0.0-alpha.7",
"eslint-config-next": "^13.4.0",
"next-sitemap": "^4.0.7",
"prettier-plugin-tailwindcss": "^0.2.3",
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/docs/routing/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import {Card} from 'nextra-theme-docs';

# Internationalized routing

With the introduction of the App Router, Next.js no longer provides integrated i18n routing. To fill in the gap, `next-intl` provides the two necessary pieces:
When you provide content in multiple languages, you want to make the content available under distinct URLs (e.g. `ca.example.com/en/about`). `next-intl` provides the building blocks to set up internatinoalized routing as well as the navigation APIs to enable you to link between pages.

<div className="mt-8 flex flex-col gap-4 md:w-1/2">
<Card
arrow
icon={<BoltIcon />}
title="Internationalized routing middleware"
title="Routing middleware"
href="/docs/routing/middleware"
/>
<Card
Expand All @@ -19,3 +19,5 @@ With the introduction of the App Router, Next.js no longer provides integrated i
href="/docs/routing/navigation"
/>
</div>

Note that these features are only relevant if you use the App Router. If you're using [`next-intl` with the Pages Router](/docs/getting-started/pages-router), you can use the [built-in capabilities from Next.js](https://nextjs.org/docs/pages/building-your-application/routing/internationalization).
70 changes: 51 additions & 19 deletions docs/pages/docs/routing/middleware.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export const config = {
};
```

In addition to handling i18n routing, the middleware sets [the `link` header](https://developers.google.com/search/docs/specialty/international/localized-versions#http) to inform search engines that your content is available in different languages.

## Strategies

There are two strategies for detecting the locale:
Expand All @@ -31,7 +33,7 @@ There are two strategies for detecting the locale:

Once a locale is detected, it will be saved in a cookie.

### Prefix-based routing (default) [#prefix-based-routing]
### Strategy 1: Prefix-based routing (default) [#prefix-based-routing]

Since your pages are nested within a `[locale]` folder, all routes are prefixed with one of your supported locales (e.g. `/de/about`). To keep the URL short, requests for the default locale are rewritten internally to work without a locale prefix.

Expand Down Expand Up @@ -60,7 +62,7 @@ To change the locale, users can visit a prefixed route. This will take precedenc
4. When the user clicks on the link, a request to `/en` is initiated.
5. The middleware will update the cookie value to `en` and subsequently redirects the user to `/`.

### Domain-based routing
### Strategy 2: Domain-based routing [#domain-based-routing]

If you want to serve your localized content based on different domains, you can provide a list of mappings between domains and locales to the middleware.

Expand Down Expand Up @@ -189,7 +191,7 @@ In this case, only the locale prefix and a potentially [matching domain](#domain

The middleware automatically sets [the `link` header](https://developers.google.com/search/docs/specialty/international/localized-versions#http) to inform search engines that your content is available in different languages. Note that this automatically integrates with your routing strategy and will generate the correct links based on your configuration.

If you prefer to include these links yourself, e.g. because you're using [locale-specific rewrites](#localizing-pathnames), you can opt-out of this behavior.
If you prefer to include these links yourself, you can opt-out of this behavior.

```tsx filename="middleware.ts" {6}
import createMiddleware from 'next-intl/middleware';
Expand All @@ -203,27 +205,56 @@ export default createMiddleware({

## Localizing pathnames

If you want to localize the pathnames of your app, you can accomplish this by using appropriate [rewrites](https://nextjs.org/docs/api-reference/next.config.js/rewrites).
Many apps choose to localize pathnames, especially when search engine optimization is relevant, e.g.:

- `/en/about`
- `/de/ueber-uns`

Since you want to define these routes only once internally, you can use the `next-intl` middleware to [rewrite](https://nextjs.org/docs/api-reference/next.config.js/rewrites) such incoming requests to shared pathnames.

```js filename="next.config.js" {7-8}
const withNextIntl = require('next-intl/plugin')();
```tsx filename="middleware.ts"
import createMiddleware from 'next-intl/middleware';

export default createMiddleware({
defaultLocale: 'en',
locales: ['en', 'de'],

module.exports = withNextIntl({
rewrites() {
return [
{
source: '/de/über',
destination: '/de/about'
}
];
// The `pathnames` object holds pairs of internal and
// external paths. Based on the locale, the external
// paths are rewritten to the shared, internal ones.
pathnames: {
// If all locales use the same pathname, a single
// external path can be used for all locales.
'/': '/',
'/blog': '/blog',

// If locales use different paths, you can
// specify each external path per locale.
'/about': {
en: '/about',
de: '/ueber-uns'
},

// Dynamic params are supported via square brackets
'/news/[articleSlug]-[articleId]': {
en: '/news/[articleSlug]-[articleId]',
de: '/neuigkeiten/[articleSlug]-[articleId]'
},

// Also (optional) catch-all segments are supported
'/categories/[...slug]': {
en: '/categories/[...slug]',
de: '/kategorien/[...slug]'
}
}
});
```

Since `next-intl` isn't aware of the rewrites you've configured, you likely want to make some adjustments:

1. Translate the pathnames you're passing to [navigation APIs](/docs/routing/navigation) like `Link` based on the `locale`. See the [named routes example](https://github.com/amannn/next-intl/blob/feat/next-13-rsc/examples/example-next-13-named-routes/) that uses the proposed APIs from [the Server Components beta](https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components).
2. Turn off [the `alternateLinks` option](/docs/routing/middleware#disable-alternate-links) and provide [search engine hints about localized versions of your content](https://developers.google.com/search/docs/specialty/international/localized-versions) by yourself.
<Callout>
If you have pathname localization set up in the middleware, you likely want to
use the [localized navigation
APIs](/docs/routing/navigation#localized-pathnames) in your components.
</Callout>

## Composing other middlewares

Expand Down Expand Up @@ -332,7 +363,8 @@ If you're using the [static export feature from Next.js](https://nextjs.org/docs

1. There's no default locale that can be used without a prefix (same as [`localePrefix: 'always'`](#always-use-a-locale-prefix))
2. The locale can't be negotiated at runtime (same as [`localeDetection: false`](#disable-automatic-locale-detection))
3. You need to add a redirect for the root of the app
3. You can't use [pathname localization](#localizing-pathnames).
4. You need to add a redirect for the root of the app

```tsx filename="app/page.tsx"
import {redirect} from 'next/navigation';
Expand Down
Loading