B
B
bezdealnick2021-07-29 06:28:52
Database design
bezdealnick, 2021-07-29 06:28:52

Is it advisable to separate tables in the database with a small number of languages?

The site can have a maximum of 3 languages, at the initial stage there will be only 2, 3 languages ​​are not a fact at all that will be needed. For myself, I identified 2 solutions to this problem.

  1. In each table where translation into several languages ​​is needed, add <field name>_<language>
    61021e346202d476544957.png
    I don’t really like this option, since there is still a hard link in the tables themselves and it will make it difficult to add a new language, but on the other hand there will be no more languages. This is a local service.

  2. For each table where there are fields with translations, make an additional table, for example, post_language, news_language, etc.
    I like this option better, but it forces me to divide almost all tables by 2. Let's say I have regions and cities that should also be translated. As a result, the tables turn into this.
    61021e6aa152c176759630.png
    Each query, in fact, will need to be written one that makes a selection from the default language, if this text is not translated into the selected language.


How expedient is it to use the 2nd option, with a static number of languages?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
vilinyh, 2021-07-29
@vilinyh

> on the other hand, there will be no more languages
​​:)
You can take out one (actually two) common table with "translations"
610229bebc14b055475971.png
: service), not an identifier.

B
BorLaze, 2021-07-29
@BorLaze

The statement "we have three options, and there can't be a fourth" in 99% of cases is broken by the customer's Wishlist "well, we already have three options, is it not a problem to add a fourth?" :-)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question