Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to store multilingual data? [duplicate]

Possible Duplicate:
Schema for a multilanguage database

I am building a very busy web application which has multilingual data. All this data is stored in a MySQL database. What is the best way to store this data? I have a few guesses though:

  1. separate columns in the table for each language (like title_en, title_fr)
  2. separate tables for each language (like pages_en, pages_fr)
  3. cross table for translations (having an id in the pages table and having this linked id in a translation table where there are multiple columns like trans_en, trans_fr)
  4. having non-multilingual data in one table for example pages and translations in one table per language (pages_en, pages_fr)
  5. other?
like image 835
Anze Jarni Avatar asked Jul 25 '12 18:07

Anze Jarni


1 Answers

If I had to make a site multilingual, then I would design the db as follows:

enter image description here

Every page in the application can have multiple languages. You only have to filter on the language id to get the desired language for the page.

like image 150
Sven van Zoelen Avatar answered Sep 22 '22 19:09

Sven van Zoelen