目前在我正在开发的应用程序中,我们已经使用 typescript 实现了 next-i18next。
我不完全确定,但我猜 next-i18next 设置了一个名为“next-i18next”的 cookie,其值为当前语言。默认情况下,此 cookie 的 http-only 属性似乎无法使用。我们要启用此功能。
我的代码是这样的:
const { useTranslation, appWithTranslation, Router } = new NextI18Next({
defaultLanguage: 'en',
otherLanguages: ['es'],
localePath: path.resolve('./public/locales'),
detection: {
httpOnly: true,
cookieSecure: true,
cookieDomain: 'localhost',
lookupCookie: 'next-i18next',
},
})
这对我不起作用。有人知道如何启用此配置吗?欢迎不同的方法。
我正在使用的当前 next-i18next 版本是7.0.1
预先感谢您的回复。