mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
3f75ff69cb
### What? Replaces: ```ts // @ts-ignore locales are readonly const locales: string[] = i18n.locales; ``` with: ```ts const locales = Array.from(i18n.locales); ``` ### Why? Avoids suppressing TypeScript errors via @ts-ignore. Array.from safely creates a mutable copy without modifying the readonly original, making the code cleaner and more type-safe. ### How? Used Array.from(i18n.locales) instead of a forced type assertion.<br> <br> No functional change, purely a lint-/type-safety improvement. Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
Internationalized Routing
Next.js doesn't support internationalized routing in app directory out of the box. But you can easily implement it yourself. This example shows how to implement internationalized routing on the Edge.
Deploy your own
How to use
Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app --example i18n-routing i18n-routing-app
yarn create next-app --example i18n-routing i18n-routing-app
pnpm create next-app --example i18n-routing i18n-routing-app
Deploy it to the cloud with Vercel (Documentation).