Customization
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.
- Go to the
.env
file and set theNEXT_PUBLIC_ENABLE_LANG_ROUTING
to0
. - Replace the default matcher with the following code:
web/middleware.ts
- After that, move the contents of the
web/[locale]
folder to theapp
folder. Override every existing file. Delete the empty/[locale]
folder. - 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.
- Go to the
.env
file and set theNEXT_PUBLIC_ENABLE_LANG_ROUTING
to1
. - 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
- Move the contents of the
web/[locale]
folder to theapp
folder. Override every existing file. Delete the empty/[locale]
folder. - Change your request file like so:
web/i18n/request.ts
- 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.