dimis283
(Dimis283)
1
I am trying to implement the internationalization with yii.
I use 1.0.10 version.
So I make a folder views/‘mycontrollerid’/gr and I put there the translated views there as guide says.
So at my controller I write
$app->language ="gr";
$app->session['_lang'] = $app->language;
but the translated view is not there.
What have I to do?
dimis283
(Dimis283)
2
I had an error I had to write Yii::app() and now is ok.
But Is there a way to yii::t()or something for custom messages so not to have 2 files for the views?
dimis283
(Dimis283)
3
I want to ask something else.
How can I change the core translated messages of form validation?
I want to change the greek message of verification code.
I just have to edit the php of yii or implement something else.
I create the messages/gr/yii.php and change the code that I want but it does not work.
Eliovir
(Eliovir)
4
did you read the "translation" paragraph http://www.yiiframework.com/doc/guide/topics.i18n ?
An easy way is to use the "Yii::t" function in views :
Yii::t('yourcategory', 'Path alias "{alias}" is redefined.',
array('{alias}'=>$alias))
For example, you write the English text in the view.php and translate in messages/gr/yourcategory.php
there is also this recipe : http://www.yiiframework.com/doc/cookbook/26/
dimis283
(Dimis283)
5
I have already implement the cookbook.
I needed this at config/main.php
'coreMessages'=>array(
'class'=>'CPhpMessageSource',
'language'=>'gr',
'basePath'=>'protected/messages',
),
dimis283
(Dimis283)
6
I have 2 controllers.
The site controller that will have 2 languages and the support that will have 1.
So at support init() I write
public function init() {
parent::init();
$app->language = "en_us";
}
but it does not work, what must I do?
[Edit]
I solved it.
Yii::app()->language = "en_us";
Eliovir
(Eliovir)
7
Good! I was away, hopefully you didn’t need some help.