0

我正在学习数据库国际化并有一个“小”问题。

我有一个名为的表,categories其中包含字段id,等。并且,该表也具有字段、、和其他字段。namedescriptionproductsidcategory_idnamedescription

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

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

我需要将这些(和其他)表国际化。因此,开始的方法是再创建三个表并更改第一个表。

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

好吧,主要问题是:有办法将本地化“集中”在一张表中吗?我忘记了什么?

谢谢!

4

1 回答 1

2

您可以在一个表中添加翻译的标签和翻译,然后在每个表的新列中添加翻译的标签。您将有一个名为 translations 的表,其中 id 列可以是标签和翻译列:

id | label | translation | language_id

在每张桌子上:

id | some columns | translation_label
于 2012-10-14T19:35:03.073 回答