Yii Framework Forum: how to use client language - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

how to use client language Rate Topic: -----

#1 User is offline   fred_avignon 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 18-October 09

Posted 21 October 2009 - 02:26 PM

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 ?
0

#2 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 21 October 2009 - 02:56 PM

I think this can be done with a onMissingTranslation() handler.
http://www.yiiframew...nslation-detail

You should be able to translate the message attribute of
http://www.yiiframew...ranslationEvent
(in-place) using the more generic language. Not tested, though.

/Tommy
Don't forget to read The Definitive Guide to Yii (en) (sv) | The class reference has the details
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users