Yii Framework Forum: Example of changing language - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Example of changing language Rate Topic: -----

#21 User is offline   Sam G'nar 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 16-January 12

Posted 25 January 2012 - 12:26 AM

Hey..... thanks for sharing this. :rolleyes:
0

#22 User is offline   Venu Gopal Mopidevi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 20-February 12
  • Location:Hyderabad

Posted 06 February 2013 - 06:34 AM

View PostY!!, on 25 January 2010 - 01:07 PM, said:

If you do:

Yii::t('test', "example message");


"example message" must be in the language defined over Yii::app()->sourceLanguage. If you set sourceLanguage to something else (eg: xx), you can then provide translation for your original sourceLanguage - "xx" does not exist and is used as a dummy.

Yii::app()->sourceLanguage = 'xx';
Yii::app()->language = 'en';
Yii::t('test', "0001");


You must provide this file: "protected/messages/en/test.php":

return array(
   '0001' => 'example message';
);


So you can basically use placeholders as keys and provide translations for all possible languages.


Y!! @ Thanks it's really usefully.
0

#23 User is offline   ruderbytes 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 05-November 12
  • Location:Indonesia

Posted 17 May 2013 - 11:58 PM

Wow Good Extention
:)
0

#24 User is offline   hshfcb 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 12-August 13

Posted 05 September 2013 - 03:17 AM

thanks a lot,,this is very very goood :D
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • 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