I'm also wondering, what settings are better for best performance? I mean, should i use /framework/messages/ stuff ? or i can use "custom" messages in webroot/protected/messages?
Are you developing a multilanguage application? If not, you don't need to use this. (If you only want to make those validation messages to appear in Russian, you can simply configure the 'message' option in the rules).
If you ARE developing multilanguage application, you may choose to store translated messages in either PHP array (CPhpMessage) or database (CDbMessageSource). If using the former, you don't need to configure anything since Yii already predefines the 'messages' source. All you need is to put the translated messages under 'protected/messages'.
you can simply configure the 'message' option in the rules
Can you please tell me how to do that? I'm all over docs, but can't find the right way to do it.
I can simply add 'language' => 'ru' to config/main.php but it'll use /framework/messages files, and they are actually can and will change in further Yii releases, and i don't want new Yii version to overwrite my custom messages.
What i mean is I sure can use 'language' option, but it just seems a bit wrong, and i want to know if it's the right way to do - to edit framework files, or is there a nice way to tell Yii to use my customized and translated messages, those i will store in webapp/protected/
Yes, you also set 'language' property of your application to be 'ru' to make use of the translated messages included in Yii. However, in case a message is not translated in Yii, you still need to do it yourself by explicitly specify the 'message' option. An example is as follows:
class MyModel extends CActiveRecord
{
public function rules()
{
return array(
array('name', 'required', 'message'=>'This field is required.'),
);
}
}
Ok, well, you might actually think that i'm a totall idiot, but i still don't get it.
In template i have:
<?php echo CHtml::label('Remember me next time',CHtml::getActiveId($form,'rememberMe')); ?>
in my model (loginfrom):
public function rules()
{
return array(
// username and password are required
array('username, password', 'required'),
// password needs to be authenticated
array('password', 'authenticate'),
);
}
So, how do i properly change the "Remember me next time" text, without hacking /framework/ stuff? Please, help me.