I need a little help with creating a database for a multiple language web site. I have a feeling that I am creating a monster. So any advice will be very helpful. I have two tables for the articles.
This table contains data that will be the same for every language:
article
id_article
images
date_created
date_start
date_end
This table contains data that is different – Text in English is not the same as the text in German.
article_info
article_id
title
text
info
category_id
lang_id
Idea behind this is that one article can be in multiple different languages. Is this a good way of building the tables or am I doing something wrong? Is there a better way to do this?
I believe this design, in which an article can have one or more renderings in different languages, will work well. I’ve worked on a similar system, where the multiple languages were an afterthought. On that system, the primary language (EN-us usually) had columns in the article table. This is better.
One thing to think about: You may, or may not, want to be able to store an article’s summary data such as titles, subjects, keywords, and possibly an abstract in multiple languages even if you don’t possess a translation for the whole article. So, instead of article_info, you may want separate tables for title_info, text_info, keyword_info, and so forth, each with a lang_id key.
Pay attention to your character set (utf8 is a good choice) and collation. Your default collation should be utf8_general_ci, but your
may need to be set user-by-user based on a user-preference setting. For example,
COLLATE utf8_general_ciwon’t do the right thing for Spanish-language titles in which n and ñ are different letters.