What#39;s the best database structure to keep multilingual data?(保存多语言数据的最佳数据库结构是什么?)
问题描述
可能的重复:
多语言数据库的架构
这是一个例子:
问题:每种新语言都需要修改表结构.
The problem: every new language will need modify the table structure.
这是另一个例子:
问题:每种新语言都需要创建新表,并且每个表中的价格"字段都是重复的.
The problem: every new language will need the creation of new tables and the "price" field is duplicated in every table.
这是另一个例子:
问题:难吗?
推荐答案
你的第三个例子实际上就是通常解决问题的方式.很难,但可行.
Your third example is actually the way the problem is usually solved. Hard, but doable.
从翻译表中删除对产品的引用,并将对翻译的引用放在您需要的地方(相反).
Remove the reference to product from the translation table and put a reference to translation where you need it (the other way around).
作为替代方案(不是特别好),您可以拥有一个字段并将所有翻译合并在一起(例如 XML).
As an alternative (not especially a good one) you can have one single field and keep all translations there merged together (as XML, for example).
这篇关于保存多语言数据的最佳数据库结构是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!