[Example needed] i18n with Next.js 13 and `app` directory
Problem
Verify canary release - [X] I verified that the issue exists in the latest Next.js canary release Provide environment information Operating System: Platform: win32 Arch: x64 Version: Windows 10 Home Binaries: Node: 16.15.0 npm: N/A Yarn: N/A pnpm: N/A Relevant packages: next: 13.0.1-canary.0 eslint-config-next: 13.0.0 react: 18.2.0 react-dom: 18.2.0 What browser are you using? (if relevant) Chrome How are you deploying your application? (if relevant) Local Describe the Bug Setting up i18n test in next.config as follows: [code block] I've deleted pages and added a few files into the new /app folder to test Creating a simple component like so: [code block] I'm not seeing any locale information provided via the props. I was thinking this would be provided on the server side for rendering locale specific data on the server. Expected Behavior I would expect to be passed the current locale for use within sever components layouts/pages. Link to reproduction https://github.com/jimmyjamieson/nextjs-13-ts To Reproduce npm dev, check output of props, locale in layout
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: [Example needed] i18n with Next.js 13 and `app` directory
Middleware only seems to work for routes under `/pages`, anything under `/app` does not run your middleware. We have the use-case where our default locale (en-us) does not have a subdirectory i.e. `/about` vs `/en-us/about` so there's not an easy way to replicate the behavior of the old i18n feature from <= Next 12 Would love to hear from one of the Nextjs devs on how they foresee i18n routing bei
Trust Score
4 verifications
- 1
Middleware only seems to work for routes under `/pages`, anything under `/app` d
We have the use-case where our default locale (en-us) does not have a subdirectory i.e. `/about` vs `/en-us/about` so there's not an easy way to replicate the behavior of the old i18n feature from <= Next 12 Would love to hear from one of the Nextjs devs on how they foresee i18n routing being implemented on Next 13+
Validation
Resolved in vercel/next.js GitHub issue #41980. Community reactions: 7 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep