MySQL Database Design with Internationalization

Posted by Some name on Stack Overflow See other posts from Stack Overflow or by Some name
Published on 2011-01-04T17:12:49Z Indexed on 2011/01/04 22:54 UTC
Read the original article Hit count: 227

Hello, I'm going to start work on a medium sized application, and i'm planning it's db design. One thing that I'm not sure about is this. I will have many tables which will need internationalization, such as: "membership_options, gender_options, language_options etc"

Each of these tables will share common i18n fields, like: "title, alternative_title, short_description, description"

In your opinion which is the best way to do it? Have an i18n table with the same fields for each of the tables that will need them?

or do something like:

Membership table     Gender table
----------------     --------------
id | created_at       id | created_at
1  -  22.03.2001       1 - 14.08.2002
2  -  22.03.2001       2 - 14.08.2002


General translation table
-------------------------
record_id | table_name | string_name | alternative_title| .... |id_language
 1        - membership   regular         null                     1 (english)
 1        - membership   normale         null                     2 (italian)
 1        - gender       man             null                     1(english)
 1        -gender        uomo           null                      2(italian)

This would avoid me repeating something like:

membership_translation table
-----------------------------
membership_id | name | alternative_title | id_lang
1               regular  null             1
1               normale  null             2

gender_translation table
-----------------------------
gender_id | name | alternative_title | id_lang
1           man     null                1
1           uomo    null                2

and so on, so i would probably reduce the number of db tables, but i'm not sure about performance.I'm not much of a DB designer, so please let me know.

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql