Santosh
Santosh

Reputation: 33

How to localize sql server data?

We have a requirement to develope an application that support multiple languages (English, German, French, Russian) and we know, we can use ASP.NET localization to localize static text of a web form but what would be the approach for data localization of a database in SQL server.

for example my database schema is something like this:

Table-Questions

QID-PK

Question

CreatedBy

Table- Answer

AID-PK

QID- FK

Answer

AddedBy

In the above schema,I want the column "question" from Question table and column "Answer" from Answer table should keep localization value.

How do I achive this.

Upvotes: 0

Views: 5739

Answers (2)

Clafou
Clafou

Reputation: 15400

Add a Language table:

  • LanguageID-PK
  • LanguageIdentifier (name as accepted by CultureInfo's constructor, e.g. "de" for German)

Add a TranslatedQuestion table:

  • TQID-PK
  • QID-FK
  • LanguageID
  • Translation

Likewise, add a TranslatedAnswer table:

  • TAID-PK
  • AID-FK
  • LanguageID
  • Translation

This way, of course there is nothing in the data model to guarantee that every question/answer has a transation for a given language. But you can always fall back to the untranslated question/answer.

Upvotes: 3

cjk
cjk

Reputation: 46425

Add a culture column to the table, then repeat the questions and answers in the culture specific format.

Upvotes: 0

Related Questions