Multilingual website - a question

Hey there! :lol:

I have a question for you experts.

I am willing to create a multilingual website.

So in order to do that, I’ve planned to create a translations table, which will contain the following columns:

id, lang_id, table, key, value

The table col means which table is the row related to.

The bottom line - how I make an ActiveRecord attach a new JOIN clause to the query which will take values from the translations table?

Is there a better idea how to create a multilingual website?



you can use Yii internalization…


it is not a good idea to store models’ translations in single table.

Try to create for each translatable model translation table with appropriate foreign key, language id and translatable columns.

For example:

– table Events

id slug title content start_date end_date

– table Events_translation

event_id lang_id title content