how to use client language

I’m not sure the title is clear :unsure:

Hello from south of France

I’m learning to use Yii and I try to translate a web site using the language provided by the client. For example : fr_ca. In Yii, error messages are in a table with code ‘fr’. So the framework looks for translation file for ‘fr_ca’ and cannot find it. It’s normal. It should be a good idea in that case to look for a more generic translation file for the upper level (fr)

I would like to modify the method translateMessage(…) of class CMessageSource but i’m afraid it could break compatibility with next version of Yii.

Any idea how to solve this common problem ?

I think this can be done with a onMissingTranslation() handler.

You should be able to translate the message attribute of

(in-place) using the more generic language. Not tested, though.