我正在开发一个使用React、i18next和i18next-browser-languagedetector的多语言应用程序。
i18next-browser-languagedetector在浏览器中检测用户语言,支持: cookie、localStorage、navigator、querystring、htmlTag
我应该用另一个模块验证来自HTTP请求头的接受语言吗?
发布于 2018-01-16 11:31:30
请求头在服务器端得到评估,所以不是浏览器语言检测->的一部分,它是服务器端的中间件。特快专递有自己的探测器:
https://github.com/i18next/i18next-express-middleware#language-detection
另外,react i18下一次使用的服务器端呈现示例:https://github.com/i18next/react-i18next/blob/master/example/nextjs/server.js#L16。
https://stackoverflow.com/questions/48266917
复制相似问题