翻译数据库字符串

发布于 2024-11-15 09:04:27 字数 686 浏览 8 评论 0原文

我有一个为英国市场编写的应用程序,目前仅支持英语(英国),并且客户希望将应用程序的一部分部署到非英国站点并将数据同步回英国总部。

我可以使用资源文件和本地文化信息转换应用程序标签和消息,但想知道如何转换数据库绑定数据。

例如 这是基于总部的表格

tblFault
ID ; Description
1 ; Not Functional
2 ; Build Fault
3 ; Leak
4 ; Aesthetics
5 ; Testing

如果我要将数据翻译为非英国语言,我可以只替换描述,但如果数据不同步,这会导致一些问题?

我是否应该用另一列扩展表格以获取其他语言,然后使用当地文化更改选择?

tblFault
ID ; Description-EN ; Descrption-US ; Description-DE etc
1  ; Not Functional ;               ;
2  ; Build Fault    ;               ;
3  ; Leak           ;               ;
4  ; Aesthetics     ;               ;
5  ; Testing        ;               ;

您会推荐什么方法?

谢谢菲尔

I have an application written for the UK market that currently only supports English (UK) and a client wants to deploy part of the application out to a non UK site and syncronise the data back to the UK HQ.

I can convert the application labels and messages using resource files and the local culture information but was wondering how you would convert the database bound data.

E.G.
Here is the HQ based table

tblFault
ID ; Description
1 ; Not Functional
2 ; Build Fault
3 ; Leak
4 ; Aesthetics
5 ; Testing

If I was to translate the data to the non UK language I could just replace the descriptions but this would cause some problems if the data is unsyncronised?

Should I extend the table with another column for additional language and then alter the selection using the local culture?

tblFault
ID ; Description-EN ; Descrption-US ; Description-DE etc
1  ; Not Functional ;               ;
2  ; Build Fault    ;               ;
3  ; Leak           ;               ;
4  ; Aesthetics     ;               ;
5  ; Testing        ;               ;

What method would you recommend?

Thanks

Phil

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你的往事 2024-11-22 09:04:27

由于故障与其描述之间存在 1:n 关系,因此最干净的解决方案是创建一个子表:

tblFault
--------

FaultID ; some other fields
      1 ; ...
      2 ; ...
      3 ; ...
      4 ; ...
      5 ; ...


tblFault_Description
--------------------

FaultID ; lang ; Description
      1 ; en   ; Not Functional
      1 ; de   ; Funktioniert nicht
      2 ; en   ; ...

Since you have a 1:n relationship between faults and their descriptions, the cleanest solution would be to create a subtable:

tblFault
--------

FaultID ; some other fields
      1 ; ...
      2 ; ...
      3 ; ...
      4 ; ...
      5 ; ...


tblFault_Description
--------------------

FaultID ; lang ; Description
      1 ; en   ; Not Functional
      1 ; de   ; Funktioniert nicht
      2 ; en   ; ...
染火枫林 2024-11-22 09:04:27

这绝对是一种方法。

我之前在类似情况下使用的另一种方法是创建一个“LanguageId”列。

通常我会有这样的内容:

StringId,  LanguageId,    Description
1            0              Hello
1            1              Hola
1            2              Bon Jour

这允许我编写一个查询,如果字符串 35(例如)没有我正在寻找的语言,我仍然可以提供英语。想法是有总比没有好。

这种方法的缺点是复合主键和一些连接逻辑。

That's definitely one approach.

Another approach that I've used in situations like this before was to create a "LanguageId" column.

Typically I would have something like this:

StringId,  LanguageId,    Description
1            0              Hello
1            1              Hola
1            2              Bon Jour

This allow me to write a query that if string 35 (for example) doesn't have the language I'm looking for, I could still provide English. With the thought being that something is better than nothing.

The downside to this approach is composite primary keys, and some join logic.

探春 2024-11-22 09:04:27

很可能更像这样:

tblFault
ID ; Lang ; Description
1  ; EN   ; Not Functional
...

Something more like so, in all likelihood:

tblFault
ID ; Lang ; Description
1  ; EN   ; Not Functional
...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文