我知道 NextJS 支持自动国际化,事实上,如果我导航到根目录,我的网站会将我重定向到特定的语言环境,但是如果我想访问没有语言环境的页面并自动添加它怎么办?就像 xy.z/register 变成 xy.z/it/register
我尝试了 next.config.js 中的所有内容,但无法实现。 这些是我的 next.config.js 和 next-i18next.config.js
NEXT.CONFIG.JS
const { i18n } = require("./next-i18next.config")
module.exports = {
i18n,
}
NEXT-I18NEXT.CONFIG.JS
module.exports = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'it'],
detectLocale: true
},
};