[英]How to choose between 2 languages on a website?
I'm going to build a new portfolio with Next.js, and I would like to have 2 differents languages available .我将使用 Next.js 构建一个新的产品组合,并且我希望有 2 种不同的语言可用。
Of course, I don't want to create 2 pages for each page, so I'm thinking about how to deal with it.当然,我不想为每个页面创建2个页面,所以我正在考虑如何处理它。
I was thinking about using .json
files and call the json
file corresponding to the language (corresponding to the url /fr/ or /.com/).我正在考虑使用
.json
文件并调用与语言对应的json
文件(对应于url /fr/或/.com/)。 Does that makes sense?这有意义吗? If yes, can you tell me how to do it properly?
如果是的话,你能告诉我如何正确地做到这一点吗?
Do you know another way to do it, maybe more optimized?你知道另一种方法吗,也许更优化?
I strongly suggest using next-i18next you can easily implement localization in both server side and client side and also they will async your link no need to extra configuration.我强烈建议使用next-i18next您可以轻松地在服务器端和客户端实现本地化,并且它们将异步您的链接,无需额外配置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.