e35ace6575
## What? To avoid the default `favicon.ico` request by the browser, we are adding a vercel `favicon.ico` to the project. Currently, we handle exceptions for `favicon.ico` entering the Dynamic Route `[lang]` in the following manner, but in this case, favicon.ico renders the entire page. [example:app-dir-i18n-routing](https://github.com/vercel/next.js/blob/canary/examples/app-dir-i18n-routing/get-dictionary.ts#L12) ```ts export const getDictionary = async (locale: Locale) => dictionaries[locale]?.() ?? dictionaries.en(); ``` Instead of `favicon.ico`, the full HTML of the default language 'en' is rendered. ![스크린샷 2024-02-26 오전 1 17 56](https://github.com/vercel/next.js/assets/59330828/ea46b75b-ae93-4db4-9b4b-db33fb5d5709) In the correct case ![스크린샷 2024-02-26 오전 1 24 49](https://github.com/vercel/next.js/assets/59330828/7faabec1-1fc7-4330-a5c3-30449efcace6) Fixes https://github.com/vercel/next.js/issues/46918 Co-authored-by: Sam Ko <sam@vercel.com> |
||
---|---|---|
.. | ||
.vscode | ||
app/[lang] | ||
dictionaries | ||
public | ||
.gitignore | ||
get-dictionary.ts | ||
i18n-config.ts | ||
middleware.ts | ||
next-env.d.ts | ||
package.json | ||
README.md | ||
tsconfig.json |
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
Deploy the example using Vercel or preview live with StackBlitz
How to use
Execute create-next-app
with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app --example app-dir-i18n-routing i18n-app
# or
yarn create next-app --example app-dir-i18n-routing i18n-app
# or
pnpm create next-app --example app-dir-i18n-routing i18n-app
Deploy it to the cloud with Vercel (Documentation).