Gabriel Santos
Gabriel Santos

Reputation: 4974

Internationalization of table fields

I am learning about database internationalization and have a "small" question.

I have one table named categories which have the fields id, name, description among others. And, the table products which have the fields id, category_id, name, description and others too.

categories table
id | name | description | ...others

and

products table
id | category_id | name | description | ...others

I need to Internationalize these (and others) tables. So, the start approach are creating three more tables and change the first ones.

languages table
id | name | code

categories table
id | ...others

category_languages table
id | category_id | language_id | name | description

products table
id | category_id | ...others

product_languages table
id | product_id | language_id | name | description

Well, the main question is: Have a way to "centralize" the localization in one table? What I am forgetting?

Thanks!

Upvotes: 0

Views: 254

Answers (1)

Kokozaurus
Kokozaurus

Reputation: 639

you can add the label of the translation and the translation in one table and then just add to a new column in every table the label of the translation. You will have one table called translations with id column which could be the label and translation column:

id | label | translation | language_id

and in every table:

id | some columns | translation_label

Upvotes: 2

Related Questions