In a recent project, a website needs to be switched between Chinese and English. It has been a long time since it was completed? Is there any practical method that can be used? Just use two templates. The Chinese version is already online. Now I just want to add a switching function.
vine2017-10-27 20:03:59
Uniform reply: I searched for various information, but in the end I still had no choice, so I made another English website and database.
In collecting information, I found that most APIs now require payment, and there are very few that can translate the entire site for free. However, Bing Translate has a plug-in that is very useful. The disadvantage is that it is too ugly, cannot modify the style, is not easy to embed into web pages, and the translation is inaccurate. However, the speed is really fast. I recommend it to students who need it. The renderings are as follows. This method should only be used as a last resort. If you want accurate translation, it is better to find a professional to translate it, and it is best to use a database for storage.
##
ocean2017-10-27 17:29:48
Use lang to implement, that is to say, when you want to display specific content, use the corresponding key in lang. Change the key to a specific content in Chinese and a specific content in English. Finally, you need to display that content. It depends on which language the user chooses (Chinese or English)
lmaster2017-10-27 11:24:38
This depends on their needs. If it is just navigation and other fixed things that require English, then use lang. You can learn tp's lang. If it is English for the whole site, then you need to find a Chinese-English converter. Baidu and Tencent seem to have APIs