Data localization in SQL Server with GUIDs or…?

三世轮回 提交于 2019-12-03 15:13:06

First of all, I'd strongly recommend using an existing standard for the localization identifiers - don't re-invent yet another system! Use the ISO-639 standard codes for language, e.g. "en" for English, "fr" for French etc.

See Wikipedia for a list of all the defined codes.

Secondly, in my experience and my judgment, I would use a language table per entity.

We typically have some "system name" on the main table, e.g. the English text, and then we have a table "(entity)_TX" for the textual representation in various languages.

Something like this:

  TABLE CustomerType
      CustomerTypeID    INT IDENTITY(1,1) PK
      CustomerTypeName  VARCHAR(100)    -- English "system" name, e.g. "Gold customer"

  TABLE CustomerType_TX
      CustomerTypeID    INT
      LanguageID        CHAR(2)   -- ISO-639 codes
      CustomerTypeText  VARCHAR(200)   -- translated texts

To me, this is clearer and more explicit and more "intuitive" than having a single, GUID-based encoding scheme.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!