【发布时间】:2021-02-25 08:02:25
【问题描述】:
我正在尝试根据当前子域翻译我的 Next 应用程序。例如,我希望en.hello.com 使用英语,it.hello.com 使用意大利语。
我正在尝试使用 Next 的 domain routing 来实现这一目标,但显然,这并不意味着与子域一起使用,而是与顶级域(例如英语和意大利语的 hello.en 和 hello.it)一起使用.
这是我的 next.config.js:
module.exports = {
i18n: {
locales: ["en", "it"],
defaultLocale: "en",
domains: [
{
domain: "en.hello.com",
defaultLocale: "en",
},
{
domain: "it.hello.com",
defaultLocale: "it",
},
],
},
};
这些设置无法将en.hello.com 映射到英语,将it.hello.com 映射到意大利语。
谁能解释为什么会这样以及如何在 Next 中实现子域路由?
【问题讨论】:
标签: reactjs routes localization internationalization next.js