2
votes

I'm currently creating a multi-lingual website, and I have different types of words that are being translated all across the website. However, whats the best practice when it comes to storing this in the database? This is what I currently do:

I have the language Norwegian and English.

My database looks like this:

Language select

Whenever I add a new language it get added into the languages table like this:

Languages table

At the same time a new table will be created with looking like this language_en. Using the value in language_val.

Later on I use URL routing to retrieve en, no or whatever language and fetch the website information from the correct table.

My question is, should I rather have only 1 table and use the language_id in this one? or is it perfectly fine to split up languages into multiple tables?

Each language table would look just like this: language table

1
Java would handle this as locale specific resource bundles.duffymo
@duffymo What about PHP?Gjert
Don't know; I don't write PHP. Did you tag your question? Sorry I see that you did now. I missed it.duffymo

1 Answers

1
votes

With Silverlight (and later with PHP) I've done this by putting the language's in the same table, this worked fine and was user friendly (easy to edit). Only when retrieving data you should off course only select the language you need.