良好的数据库表设计用于存储本地化版本的数据 [英] Good database table design for storing localized versions of data

查看:185
本文介绍了良好的数据库表设计用于存储本地化版本的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一些表来存储一些数据,这些数据必须稍后转换成不同的语言。任何人都可以为此提供一些最佳做法或指南?



谢谢

解决方案>

假设您的产品表格如下所示:

 产品
----- -----
id
价格

Products_Translations
----------------------
product_id
locale
名称
描述

然后您只需加入product_id = product.id,其中locale ='en-US'



当然这对性能有影响,因为您现在需要加入才能获得名称和描述,但它允许任何数量的语言环境。


I'm trying to design some tables to store some data, which has to be converted to different languages later. Can anybody provide some "best practices" or guidelines for this?

Thanks

解决方案

Let's say you have a products table that looks like this:

Products
----------
id
price

Products_Translations
----------------------
product_id
locale
name
description

Then you just join on product_id = product.id and where locale='en-US'

of course this has an impact on performance, since you now need a join to get the name and description, but it allows any number of locales later on.

这篇关于良好的数据库表设计用于存储本地化版本的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆