Best practice Internationalization

Dear all

My question comes from a project I’m working on. I have a regular app, with a db containing some entities (e.g. a book with a text description). So I populate the DB with the correct information.

Now I want to add internationalization. With Yii::t this is simple although only for the static text in my html. The text from the db (e.g. the description of the book) is not automatically translated or extracted from yii message/extract so I would need to do that manually. On top of that, yii::t is very sensitive so a tab or space more make the string different for Yii::t

If we would look to the DB solution, I would need to store all my text in the database (also insignificant static text) and I would need to reference all entity data with a FK (so description would be an int foor book referencing a DB table with the translation). This seems ver cumbersome.

What are the other alternatives? Which best practices are you using?

Kind regards

Jens Buysse

Yii::t() is for messages, not for content. For content you have to come up with your own solution which is project-specific most of the time. Something like that:

Have not used it yet but you could use:

I used the version for yii-1 and it worked well.

Regards

This does seem like a good method, althoug still very cumbersome :)