[英]What is the best practice to store multi language text in a react web site
I am building a react website, and It has multiple localizations.我正在构建一个 React 网站,它有多个本地化。 What is the best practice to store ui texts for different languages?存储不同语言的 ui 文本的最佳做法是什么? I am currently considering the two我目前正在考虑这两个
What is the best practice to implement text storage for multiple localization react app?为多个本地化反应应用程序实现文本存储的最佳实践是什么?
First, you need to use npm packages i18next react-i18next
首先需要使用npm包i18next react-i18next
Here is good tutorial how to do it这是如何做到这一点的好教程
https://www.mindbowser.com/adding-multi-language-support-using-reactjs/ https://www.mindbowser.com/adding-multi-language-support-using-reactjs/
You should save as local Json, no need for static translation to be served from server.您应该保存为本地 Json,不需要从服务器提供静态翻译。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.