Yii Framework Forum: Internationalization config? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Internationalization config? Rate Topic: -----

#1 User is offline   RuudBurger 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 23-February 09

Posted 24 February 2009 - 05:28 PM

I cant seem to get Internationalization to work because there isn't a clear config example in the docs.

I can do

'language'=> 'nl'

inside my config.php
And then translate some messages under framework/yii/messages/nl/yii.php, but then when I want to update yii this file is overwritten.

What I want is that it uses protected/messages/nl/yii.php
How do i accomplish this? No useful config example in the docs...
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,857
  • Joined: 04-October 08
  • Location:DC, USA

Posted 24 February 2009 - 05:48 PM

Do not modify code under framework.

Because currently there's no Netherland translation of those core messages, you will need to explicitly specify error messages in your validation rules (I guess that's where you need it). Please refer to http://www.yiiframew...doc/cookbook/1/
0

#3 User is offline   RuudBurger 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 23-February 09

Posted 24 February 2009 - 05:51 PM

I managed to "translate" the error messages of my forms. But i want to translate the framework messages too. Like "Please fix the following input errors:".
Even when the Dutch (nl) translation of the yii.php files comes out, i want to keep my own file, because sometimes the messages are too "technical".
Is there no way of translating the yii.php file outside of the framework directory?
0

#4 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,857
  • Joined: 04-October 08
  • Location:DC, USA

Posted 24 February 2009 - 08:18 PM

You can customize the 'coreMessage' component which provides the core message translations. Below is the default configuration:

'coreMessages'=>array(
'class'=>'CPhpMessageSource',
'language'=>'en_us',
'basePath'=>YII_PATH.DIRECTORY_SEPARATOR.'messages',
),


You may change the basePath to point to your application's messages folder.
0

#5 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,857
  • Joined: 04-October 08
  • Location:DC, USA

Posted 24 February 2009 - 09:13 PM

A more detailed answer is here: http://www.yiiframew...oc/cookbook/18/
0

#6 User is offline   RuudBurger 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 23-February 09

Posted 25 February 2009 - 03:11 AM

The Yii::getPathOfAlias('application.messages') used in that cookbook article doesn't return anything in my config file, I get a blank basePath..
It gives the right path when I echo it in an controller/action though.

Got it working though, with:

'coreMessages'=>array(
'basePath' => 'protected/messages',
)


Thanks
0

#7 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,857
  • Joined: 04-October 08
  • Location:DC, USA

Posted 25 February 2009 - 07:33 AM

I updated the cookbook article. We should not use 'application' alias because it is defined AFTER the config file is read.
0

#8 User is offline   oalexandrino 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 11-June 09

Posted 27 July 2009 - 09:58 AM

View Postqiang, on 25 February 2009 - 07:33 AM, said:

I updated the cookbook article. We should not use 'application' alias because it is defined AFTER the config file is read.


im gathering information to apply the requirements implemented on my blog
http://oalexandrino....t-BR/index.aspx

where i used globalization and internationalization techquines

where can we get more information to apply what i have done in that site?

i'm starting a new project where im not gonna use asp.net..i'll use php and i've choose yii.

if blog demo app had a version with this requirements implemented it would be great.
remember that im not asking for a full implemented system, and just for a how to!

thanks!
"no one person is smart enough or has enough knowledge to figure out everything without assistance"
0

#9 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,857
  • Joined: 04-October 08
  • Location:DC, USA

Posted 29 July 2009 - 04:13 PM

I think you may read the following tutorial first:
http://www.yiiframew...oc/cookbook/26/
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

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