I have made a CMS using PHP and MYSQL for the back-end. The problem is, I'd like to have the site available in multiple languages; So I've already translated the CMS itself and put it in files like:
- en.ini
- nl.ini
Which works fine for the CMS' contents itself, like the Administration etc. The actual problem occurs when I try to translate the website further: The blogposts and pages are stored in a database, so they're dynamic. My pages table's structure looks like this:
urlname | name | id | content | position | hidden | redirect | type | permission
So, if I were to translate a page into, for example, Dutch, I don't want to create a new table called pages_nl
for example, because most of the information would be the same as the other table.
I could add a row which contains the page's available languages, and make php read the array and parse if the current $lang
matches one of the page's available languages, and then read the content_nl
and name_nl
row as an example.
The same problem would occur with my blog posts, and I have searched for a solution, but most results were for specific CMSs and just plugins.
I'm asking what would be the best way (and database structure) to store multilingual pages/posts, where languages could be added dynamically and have a fallback on the original content if there's no translated version available.