0 votes
1 view
in SQL by (22.4k points)

What is the best way to create a multi-language database? To create the localized table for every table is making design and querying complex, in other cases to add a column for each language is simple but not dynamic, please help me to understand what is the best choice for enterprise applications

1 Answer

0 votes
by (40.3k points)

For each multilingual object, you can create two tables.

Here the first table consists only language-neutral data i.e. primary key and the second table contains one record per language, 

which also contains the localized data plus the ISO code of the language.

To fall-back to that language, if no localized data is available for a specified language sometimes we add the DefaultLanguage field.

Example:

Table "Product":

----------------

ID                 : int

<any other language-neutral fields>

Table "ProductTranslations"

---------------------------

ID                 : int      (foreign key referencing the Product)

Language           : varchar  (e.g. "en-US", "de-CH")

IsDefault          : bit

ProductDescription : nvarchar

<any other localized data>

With the mentioned approach, we can handle as many languages as needed (no need to add additional fields for each new language).

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 13, 2019 in SQL by Tech4ever (22.4k points)
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...