
Template details
i18n in Edge Middleware
This template shows how to redirect users based on i18n configuration.
About this template
i18n in Edge Middleware is a Next.js template from Vercel that demonstrates how to use Edge Middleware to redirect users to localized content based on an i18n configuration.
What is i18n in Edge Middleware?
This template is an example project from the vercel/examples repository that shows how to perform internationalization (i18n) redirects at the edge using Next.js middleware. It takes an i18n configuration with supported locales and a default locale as input, and outputs HTTP redirects that send visitors to the language-appropriate path. The template runs on Next.js and is designed for deployment on Vercel, with a one-click deploy option and a live demo available at https://middleware-i18n.vercel.app.
Key Features
- Next.js Edge Middleware — The core of this template is a Next.js middleware function that runs at the network edge to make i18n redirect decisions before the request reaches the server.
- Tailwind CSS styling — The example UI is styled with Tailwind CSS, giving developers a straightforward starting point for customizing the look and feel.
- One-click Vercel deployment — A deploy button lets you push the project to Vercel instantly using the provided repository URL.
- pnpm create-next-app bootstrap — Developers can clone the example locally by running
pnpm create next-app --example https://github.com/vercel/examples/tree/main/edge-middleware/i18n. - Live demo — A hosted version of the template can be previewed at https://edge-functions-i18n.vercel.app.
- Vercel deployment documentation — The template links to the official Next.js deployment guide for production release.
Who is it for?
- Next.js developers — Build a multi-language site by copying the i18n redirect pattern into their own application.
- Vercel users — Deploy the example to Vercel to test edge-level i18n behavior on a global network.
- Learners exploring Edge Middleware — Use this minimal example to understand how to implement locale detection and redirection without pulling in a full i18n library.
Use cases
- Multi-language websites: Set up automatic redirects from the root path to a default locale (for example, /en) so every visitor starts in a localized experience.
- Locale-based personalization: Extend the middleware to redirect based on the user's Accept-Language header or a stored preference cookie.
- Global commerce: Serve different currencies or regional offers by redirecting to locale-specific URLs at the edge.















