【发布时间】:2010-01-31 20:06:10
【问题描述】:
有谁知道我怎样才能在教义上以这种特殊的方式建立 1 与 many 的关系:
在我的主表中,我有一些字段,但几乎没有一个是可以翻译的字段
Table1:
table_id <- primary key
numeric_field1
numeric_field1
numeric_field3
现在在我的 Table1_translations 我有所有可以翻译的字段
Table2:
table_id <- primary key along with language
language <- this contains 2 letters representing which language is being stored in this row
string_field1
string_field2
string_field3
我对如何用 YAML 表示这个有一个简单的想法,但我的问题是,我如何检索这些数据?
Table1:
table_id numeric_field1 numeric_field2 numeric_field3
1 123 321 415
Table2
table_id language string_field1 string_field2 string_field3
1 en hello happy world
1 es hola feliz mundo
因此,对于 table_id=1 的行,我在 table2 中有 2 行,它们对应于不同语言 (en & es) 的字符串,我试图管理某种本地化但在数据库上,因为这些可能是文字
提前致谢:)
【问题讨论】:
-
请详细点,数字字段1和字符串row1之间有对应关系吗?为什么称它为“行”1?也许是示例数据?
-
我也很困惑。您能说明您要做什么(可能有一张带翻译的表格吗?),那么您是如何尝试的,但不要将两者交织在一起。
-
您的描述与标题有何关联?您现在如何代表它,如何让我们知道您如何代表,以便我们可以帮助您?
-
抱歉调用 em 行,它们确实是字段。我已将示例数据添加到原始帖子中