For example, for a website like this, the product is the same after the language is switched, is a database shared, or is it simply a server? Www. farfetch. comcnshoppingwomencreatures-of-the-wind -- jainic-jacket -- item-11220708.aspx? Storeid99...
For example, for a website like this, the product is the same after the language is switched, is a database shared, or is it simply a server?
Http://www.farfetch.com/cn/shopping/women/creatures-of-the-wind--jainic-jacket--item-11220708.aspx? Storeid = 9946 & from = 1 & ffref = lp_pic_5_1 _
Http://www.apicloud.com/index?
Thank you!
Reply content:
For example, for a website like this, the product is the same after the language is switched, is a database shared, or is it simply a server?
Http://www.farfetch.com/cn/shopping/women/creatures-of-the-wind--jainic-jacket--item-11220708.aspx? Storeid = 9946 & from = 1 & ffref = lp_pic_5_1 _
Http://www.apicloud.com/index?
Thank you!
Generally, frameworks provide such functions, such as php codeigniter and ruby on rails.
I have not studied the specific implementation, but the idea is to get the corresponding strings in the language file based on the current language.
The language is not stored in the database, because there is not much data, it is stored in files.
In fact, this is useless. You can find a framework that supports multiple languages.
Multiple languages are divided into two parts:
1. Display strings on the page, which are translated using language files
2. the multilingual database data must be supported during database design. Generally, the Multilingual fields are placed in a multilingual table. For example, the Multilingual table corresponding to Table x is x_i18n. In the background management, users are asked to enter data in different languages. The foreground searches for corresponding data display in different languages.
1. different languages may access different website content when switching, because Chinese websites are mainly targeting Chinese, English is mainly targeting Europe and America, and website products are different in emphasis, the corresponding content will be different.
2. If you simply implement multiple languages, many frameworks will bring their own i18 functions. Use tags for pages ~
Yii2 creates a class specifically for string translation, and then references it at a time.
Return [
'Create' => 'create', 'update' => 'update', 'delete' => 'delete', 'operate' => 'operation ', 'submit '=> 'Submit', 'search' => 'search', 'reset' => 'reset ',
Implemented in multiple languages, such:
The Chinese configuration file contains
Key => 'this is the Content'
English configuration file
Key => 'this is content'
Go to www.x.com/zh/xxx.html to read the Chinese configuration file,
Go to www.x.com/en/xxx.html to read the English configuration file,
See drupal
Configure a multi-language file and follow certain rules. Use an array to translate the files that require multiple languages. When displayed, use the configuration file of any language. This is also the general implementation of the Framework.