Reputation: 4792
Is there a generally accepted solution for storing multilingual content in a database? The company I used to work for had me build a proprietary CMS and they wanted the possibility to support languages dynamically. I was pretty green then so I had a table "Languages" to hold languages and a table "Content" that held the tombstone data (published_datetime, modified_datetime, expiry_datetime, etc.).
To hold the actual content I had a table called "ContentBody" which had a columns: language_id, content_id, title, and content.
This solution worked but I didn't really bother looking more into it. I currently find myself with a lot of free time on my hands and decided I'd dabble again in CMS development and this is one of those aspects of it that I always felt I hadn't done right. I looked at the WordPress ERM diagram and it doesn't seem to have a table for multilingual content.
Any advice or comments would be awesome :)
Upvotes: 0
Views: 225
Reputation: 1257
Having a content table with compound key content_id + language_id is the approach I would follow, assuming your requirements are exactly as you stated. It's that simple unless you have other CMS requirements (e.g. versioning, workflow, approval process, etc) that would complicate it.
Upvotes: 1