Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good database table design for storing localized versions of data [closed]

I'm trying to design some tables to store some data, which has to be converted to different languages later. Can anybody provide some "best practices" or guidelines for this?

Thanks

like image 503
Vijesh VP Avatar asked Sep 25 '08 13:09

Vijesh VP


People also ask

How do you localize a database?

THERE ARE FOUR METHODS THAT ARE USED TO LOCALIZE DATABASES: Row localization – copies the original row for each language. Field localization – updates the values of the localized fields. Table localization – adds new language tables for each table. Database cloning – creates a copy of the database for each language.

When designing a database Why is it not preferable to store all data in one table?

Answer and Explanation: Storing all data in one single table will be confusing, may have security issues and there will be duplication in recording.

What are the three types of database design?

Relational model. Network model. Object-oriented database model. Entity-relationship model.

What type of data you should not stored in the database?

Finally, you shouldn't store credit card information in your database unless you absolutely need to. This includes credit card owner names, numbers, CVV numbers, and expiration dates.


2 Answers

Let's say you have a products table that looks like this:

Products
----------
id
price

Products_Translations
----------------------
product_id
locale
name
description

Then you just join on product_id = product.id and where locale='en-US'

of course this has an impact on performance, since you now need a join to get the name and description, but it allows any number of locales later on.

like image 103
Ben Scheirman Avatar answered Nov 06 '22 17:11

Ben Scheirman


Can you describe the nature of the 'dynamic data'?

One way to implement this would be to have 3 different tables:

  • Language Table
    • This table would store the language and a key :
    [1, English], 
    [2, Spanish]
  • Data Definition Table
    • When dynamic data is first entered make a record in this table with and identifier to the data:
      [1, 'Data1'], 
      [2, 'Data2']
  • Data_Language Table
    • This table will link the language, data definition and translation
      So: [Data_Language, Data_Definition, Language, Translation]
          [1, 1, 1, 'Red']
          [2, 1, 2, 'Rojo']
          [3, 2, 1, 'Green']
          [4, 2, 2, 'Verde']

          etc ...

When the dynamic data is entered create the default 'English' record and then translate at your leisure.

like image 31
DaveK Avatar answered Nov 06 '22 16:11

DaveK