I am trying to translate my Next app based on the current sub-domain. For example, I would like en.hello.com
to be in English, and it.hello.com
to be in Italian.
I am trying to achieve that using Next's domain routing, but apparently, that is not meant to be used with sub-domains but rather with top-level domains like hello.en
and hello.it
for English and Italian for example.
Here is my next.config.js:
module.exports = {
i18n: {
locales: ["en", "it"],
defaultLocale: "en",
domains: [
{
domain: "en.hello.com",
defaultLocale: "en",
},
{
domain: "it.hello.com",
defaultLocale: "it",
},
],
},
};
These settings fail to map en.hello.com
to English and it.hello.com
to Italian.
Can anybody explain why that is and how can I achieve sub-domain routing in Next?