0

What is the optimal database schema for storing multi-language data? There are many examples around the internet, to list just a few:

They are all more or less based on the same idea, and are clear enough: There should be one table storing all language-neutral data of a model, and another table storing in each row a translation with the corresponding language code.

What I am missing here is how do I translate the actual meta-data for a model? For example, if I have a Product model defined with name, description and manufacturer columns, all three previous examples show how to store the translated content. The result would be:

(English)
    Product
    Name: Chair
    Description: A sitting product
    Manufacturer: Ikea
(Spanish)
    Product
    Name: Silla
    Description: Un producto para sentarse
    Manufacturer: Ikea

But how would I store translations for the actual model's taxonomy, such as Product, Name, Description, Manufacturer? In the examples above those are either a table name or column names. How do I structure my database to keep translations for those too?

I'm not sure if this is of any importance, but my app is built in PHP (using Laravel framework). And I do know that I could use PHP's gettext(), or store such meta-data in a method and return it as needed, but I would like to avoid that, as I believe storing it in a database provides much better flexibility.

Community
  • 1
  • 1
Томица Кораћ
  • 2,542
  • 7
  • 35
  • 57
  • I think it will be a mistake to try translating database column names. What you need to translate are the various GUI labels (which may or may not relate to the database columns). Unlike the actual data, the labels are translated only once for the app. – Vatev Jul 26 '15 at 17:24
  • @Vatev I might have expressed myself wrongly. I didn't imply that I want to translate column names. After all, an app user does not need to even know that the database exists. I only asked how to implement translating meta-data for a model. I got the part about translating content, but where should I store translations for the `Product`'s field labels (`product name`, `product description`, `product manufacturer`)? – Томица Кораћ Jul 26 '15 at 17:44

0 Answers0