What is the optimal database schema for storing multi-language data? There are many examples around the internet, to list just a few:
- Multilanguage Database Design in MySQL
- Schema for a multilanguage database
- What's the best database structure to keep multilingual data?
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.