How to achieve multilingual website?

my current website environment is
ubuntu 16.04
Apache
Mariadb
Php
Jquery

I"m going to divide the website into languages at present,
but I don"t know how to cut it correctly.
the same site content, but in different languages?
websites have backgrounds and different languages

suppose you enter the English version and the interfaces are all in English
. The new content will also be in English
, but in Chinese, you will not see the English content
is very much like airbnb, apple and other websites
sites have the same content, but the language is different?
and update only needs to update the same file? (is it unlikely to copy? Difficult to manage)

Oct.17,2021

first of all, make sure that all the contents are variables, corresponding to different language packs.
in fact, the language pack is your own translation of these contents


automatic discrimination language
Cookie access lang
program i18n


is divided into two parts:
static content will have multiple file configurations, and the dynamic content of one file in each language needs to be translated. Otherwise, the English station will also come out in Chinese.
you need to configure the language resource pack in your code. The code is a copy, and the corresponding language pack data is taken according to the language parameters.
take a look at the i18n configuration of frameworks such as lavaral,sysfony,yii.


then you have to configure all the text as language files. Load different language files according to different languages. no, no, no. The content is also multiple copies of different languages


there is to find a mature framework to see how to do it, many of these functions will be managed in a corresponding way, i18n but this seems to be js's
so it is best to find this kind of function written by others on github. This function should not be miscellaneous, do not rest assured can also look at the source code, you can also knock one ah.

Menu