Category:
- Database level
- Table Level
- Field level
At the database level, different languages use different databases. The database usually contains many tables that do not involve multiple languages and there will be redundant tables.
Focuses on the table and field level:
Field level (ID, description, description_en, description_fr ...)
ID is the primary key
Advantages:
- Simple operation, one record is done
Disadvantages:
- Not conducive to expansion, such as adding a new language, you need to add a field
- Load different fields in different languages
Table Level
Table 1 (ID) ID is the primary key
Table 2 (ID, languageid, description) ID and languageid are compound primary keys
Advantages:
- Reduce redundancy and add as needed
- Easy to load and filter by language
- Easy to expand. You do not need to adjust the table structure when adding a new language.
Disadvantages:
- Operate two tables
Appendix:
Id keyid langid title
--------------------------------
1 1 wide
2 1 2 bytes
3 1 3 wide
Keyid: indicates the topic that the content belongs to (for example, the news ID)
Langid: Current Language ID
Of course, title is the title and content.
I use a similar upstairs design in a software (winform) and work well.
I also use the above design on a large website.
What I want to say is that this is not "the most effective.
Speed, speed -- or speed problems. Splitting data tables.
Http://www.doc88.com/p-37337683250.html