Question: How to integrate i18n and [locale] path
bizzul opened this issue · 1 comments
Hi There! I need to make a client website with this starter, my question is how to integrate the countryCode middleware and also the locale for setting the language, because here in Switzerland with the same CountryCode (ch) we have 4 languages.
It is possibile?
Thank you!
Hey!
It's definitely possible, but it will require some customizations on your end.
One solution that comes to mind, is replacing the ISO country code by locales like fr-ch
, de-ch
and it-ch
. You can then use the Accept-Language headers to determine the user's preferred language in middleware.
To link language locales to Medusa regions, you could use the region's metadata
object, like region.metadata.locales = ['fr-ch', 'de-ch', 'it-ch']
etc.
Here's some more info on internationalization in Next.js.
Hope this helps, good luck with the project!