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…
qiang
(Qiang Xue)
February 24, 2009, 10:48pm
2
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/
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?
qiang
(Qiang Xue)
February 25, 2009, 1:18am
4
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.
qiang
(Qiang Xue)
February 25, 2009, 2:13am
5
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
qiang
(Qiang Xue)
February 25, 2009, 12:33pm
7
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.com/home/pt-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!
qiang
(Qiang Xue)
July 29, 2009, 9:13pm
9
I think you may read the following tutorial first:
http://www.yiiframework.com/doc/cookbook/26/