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:
web/middleware.ts
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).*)',
  ],
};
  1. After that, move the contents of the web/[locale] folder to the app folder. Override every existing file. Delete the empty /[locale] folder.
  2. 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:
web/middleware.ts
return sessionResponse; // remove appConfig.i18n.enableLangRouting ? intlMiddleware(request): sessionResponse;
  1. Move the contents of the web/[locale] folder to the app folder. Override every existing file. Delete the empty /[locale] folder.
  2. Change your request file like so:
web/i18n/request.ts
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,
  };
});
  1. Customize your canonicals on your public pages.

For more information, head over to the next-intl documentation.

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