> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getlaunch.it/llms.txt
> Use this file to discover all available pages before exploring further.

# i18n - Routing

> Learn how to change the default i18n routing behavior in LaunchIt

LaunchIt per default routes the different languages using the language code as a prefix in the URL. `/en` is the default language. The other languages are prefixed with their language code (e.g. `/de` for German).

## Using a single language without prefix

If you don't want to use multiple languages, follow these steps.

1. Go to the `.env` file and set the `NEXT_PUBLIC_ENABLE_LANG_ROUTING` to `0`.
2. Replace the default matcher with the following code:

```typescript web/middleware.ts theme={null}
export const config = {
  matcher: [
    /*
     * Match all request paths except for the ones starting with:
     * - api (API routes)
     * - auth (auth routes)
     * - phog (posthog proxy)
     * - _next/static (static files)
     * - _next/image (image optimization files)
     * - favicon.ico (favicon file)
     */
    '/((?!api|phog|auth|_next/static|_next/image|favicon.ico).*)',
  ],
};
```

3. After that, move the contents of the `web/[locale]` folder to the `app` folder. Override every existing file. Delete the empty `/[locale]` folder.
4. Customize your canonicals on your public pages.

## Using multiple languages without prefix

If you want to use multiple languages without a prefix, follow these steps.

1. Go to the `.env` file and set the `NEXT_PUBLIC_ENABLE_LANG_ROUTING` to `1`.
2. Replace the default matcher for the `web/middleware.ts` with the code you'll find in the example above. Also replace the the return condition like so:

```typescript web/middleware.ts theme={null}
return sessionResponse; // remove appConfig.i18n.enableLangRouting ? intlMiddleware(request): sessionResponse;
```

3. Move the contents of the `web/[locale]` folder to the `app` folder. Override every existing file. Delete the empty `/[locale]` folder.
4. Change your request file like so:

```typescript web/i18n/request.ts theme={null}
export default getRequestConfig(async () => {
  // Provide a static locale, fetch a user setting,
  // read from `cookies()`, `headers()`, etc.
  const locale = 'en';

  if (!locale || !routing.locales.includes(locale)) {
    locale = routing.defaultLocale as Locale;
  }

  const messages = await loadMessages(locale);

  return {
    locale,
    messages,
  };
});
```

5. Customize your canonicals on your public pages.

For more information, head over to the [next-intl documentation](https://next-intl.dev/docs/getting-started/app-router/without-i18n-routing).

<Info>
  This is a custom implementation and not part of the default LaunchIt setup. You should read the docs to fully implement this feature.
</Info>
