I have one table of items, let’s call it ITEMS. Now I need to store the name of each item in multiple languages. I am looking for most efficient way to do this. So far I have these possible solutions below, but I really would like to pick one for some specific reason.
For question sake, lets keep things simple, structure of ITEMS table:
id INT PRIMARY KEY
name VARCHAR(20)
Now first easiest solution would probably be adding columns for each language in ITEMS table, e.g. name_english, name_german, name_spanish, etc… But this would probably involve a lot of work in PHP when adding new languages.
Second solution – I would create table LANGS:
id INT PRIMARY KEY,
language VARCHAR(10)
and table ITEMS_LANGS:
id_items INT
id_langs INT
translated_name VARCHAR(20)
so each time I would have to join the tables ITEMS and ITEMS_LANGS, but it would be much more easier to add new languages.
Which solution should I choose, or do you have better solution ? Thanks in advance, hope I have explained my problem in enough detail.
The second option is better if:
I’ll change ITEMS_LANGS by TEXTS (more generic):