If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Multi-language database design question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-15-08, 17:58
mayfer mayfer is offline
Registered User
 
Join Date: Jan 2008
Posts: 1
Multi-language database design question

Hello,
I have found some other threads on this topic, however i have not found the answer I'm looking for.

There's the scenario:
I am using a MySql database for a multi-language website, mainly with blogs and comments. For each blog, there will be translations in 3 other languages. However, there will be cases where one or more of the translations will NOT exist. Also, the original thread can be in any one of these 4 languages.

Here is what i came up with so far:
One DB and one table called "blogs", and a different field for each language:
blog_en_EN, blog_es_ES, etc. and a different field is selected depending on the language. This way, only one primary key is enough to identify all languages of the blog.

However, I just don't like this. It seems like it would work fine, but it's redundant.

The ideal case would be having different tables for each language which share a primary key, however I don't know if this is even possible.
If sharing a key is not possible, i think linking the languages together with another field would make it more error prone.

I would appreciate any ideas or comments,
Thanks.
- Murat
Reply With Quote
  #2 (permalink)  
Old 01-18-08, 07:44
Diabolic Diabolic is offline
Registered User
 
Join Date: Jul 2007
Posts: 96
Quote:
Originally Posted by mayfer
Here is what i came up with so far:
One DB and one table called "blogs", and a different field for each language:
blog_en_EN, blog_es_ES, etc. and a different field is selected depending on the language. This way, only one primary key is enough to identify all languages of the blog.
So, if tomorrow you support every single language in the world you end up with a table with a column for every single one of them, plus the rest of the fields needed for the blog. I would have to agree, that doesn't seem like the ideal solution at all

Quote:
Originally Posted by mayfer
The ideal case would be having different tables for each language which share a primary key, however I don't know if this is even possible.
If sharing a key is not possible, i think linking the languages together with another field would make it more error prone.
Again, your idea is to add an object (table in this case) for every possible variant of the language. Not that optimal either.

Maybe you should consider having a table that holds the blog meta data and another table that holds the actual text values, this along with a mechanism to identify and switch between the languages in which the blog is available, be it the default language for that particular post or not
Reply With Quote
  #3 (permalink)  
Old 01-18-08, 08:22
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Just a quick suggestion

PostContent(postID, languageID, content)
__________________
George
Twitter | Blog
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On