0

I have this simple database driven website and it has tables such as this,

article table,

id   title   url       content
1    Hello   hello     bla bla bla

this table keeps the English version's data only.

but now I need to create a French version for my website, what should I do with my tables for storing French version's data?

Do I have to duplicate the tables such as article table for storing French data?

Any suggestions in handling database for making a multi-languages website?

Run
  • 54,938
  • 169
  • 450
  • 748
  • You could just add a language column if you were doing the translations yourself. – Jonathan Kuhn May 14 '14 at 23:36
  • 2
    you'd need an articleID/languageID pair in there, and a table to store the languages. e.g. english = 1, french = 2, klingon = 3, etc... Anytime you THINK you need to duplicate a table just because **ONE** piece of data differentiates between the dupes, then that one piece of data could just be another field in the existing table. – Marc B May 14 '14 at 23:55
  • 1
    I don't think a table to store the languages is needed. You could just add a language column containing either `en` or `fr` here (this column could be an `ENUM`). – PLPeeters May 14 '14 at 23:58
  • I think I found the answer from this post http://www.gsdesign.ro/blog/multilanguage-database-design-approach/ – Run May 14 '14 at 23:59

1 Answers1

1

My suggestion is create a table for languages. In this table you will add many languages. In the table article you will add a id for a language and of course you will duplicate all data in this table with the French values.

Be careful to not miss any information. It means if you have values just in En and you entry into the site in Fr you will get a exception.

AFetter
  • 3,355
  • 6
  • 38
  • 62