I am developing a backend system for my applications. These applications will be multi-language.
There are some database-based modules, like menu, pages which will also be multi-language.
For these database I want to make the translation in database.
My first plan is to do it in Models. Extend the ORM Model, and rewrite the getter to automatically return the appropriate string in the appropriate language, if there is any. The translations would be stored in a table, eg lang_menu
If this is not static data, I would create an i18n table:
menu: id;menu;link
menutitle: id;menu_id;language;title
You can then define a condition on the relation which will act like a permanent filter on language. This does require that all language strings are present though.
Alternatively you could use an EAV container, where 'language' is the 'key' column, and 'title' is the 'value' column. This will allow you to access all languages simultaneously, and pick an other on a new found.
EAV creates a virtual table layout like:
menu: id;menu;german;english;french;spanish;link
// get a menu item $menuitem = Model_Menu::find(1); $title = isset($menuitem->german) ? $menuitem->german : $menuitem->english;