How to achieve multilingual switching on a website?

how does a website achieve multilingual switching?

Mar.28,2021

many i18n class libraries, the principle is that according to the locale html or js according to the configuration variable to obtain the corresponding language, eg. Stream of jquery-i18n-properties, vue-i18n


the content of a website is divided into dynamic and static:
1. Dynamic data here, in a narrow sense, refers to those obtained from the database and processed and returned to the foreground. This needs to be distinguished by adding language-related information when sending the request
2. Static data, now the general practice is to define multiple json files, the content is a field containing all the translations and worthy variables
such as: cn.json: {user:' username'}, en.json: {user:'username'},.
one for each translation. The same variable name, and then translate it according to the language, and use the variable directly when using it. -- assign the global variable of the language at the source of the global variable. Remember to reassign the global variable when switching the language.
the above is manual Chinese and English

now many frameworks have defined file schemas-i18n. Just put the data in this way and use it directly

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3dcda-2bb3d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3dcda-2bb3d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?