[Extension] Yii-Language-Behavior

I have just uploaded the initial release of a new multi language behavior: http://www.yiiframework.com/extension/yii-language-behavior/

The initial release covers just the basics. Please post any questions/suggestions to this thread.



I’m Newbie in Yii Thank you for great ekstention.

I Have problem "Undefined variable: data " ==> Create.

What happen?

Hello, thank you for the extension. But I’m having some difficulties. Could you please help me ?

  1. I’m having difficultites in setting the model rules. When I submit the form, it display error :

mb_strlen() expects parameter 1 to be string, array given

77  protected function validateAttribute($object,$attribute)

78     {

79         $value=$object->$attribute;

80         if($this->allowEmpty && $this->isEmpty($value))

81             return;


83         if(function_exists('mb_strlen') && $this->encoding!==false)

84             $length=mb_strlen($value, $this->encoding ? $this->encoding : Yii::app()->charset);

85         else

86             $length=strlen($value);

I think it is due to the attribute type, which is array and being validated in the model which only accept string. Can I still use the validation rules with this extension ? Please help, thank you

  1. Even if I pass on the validation, it display error :

Invalid argument supplied for foreach()

392 public function addErrors($errors)

393     {

394         foreach($errors as $attribute=>$error)

395         {

396             if(is_array($error))

397             {

398                 foreach($error as $e)

399                     $this->addError($attribute, $e);

400             }

401             else

402                 $this->addError($attribute, $error);

403         }

404     }

Please help thank you.

Are you trying to validate language attributes within the parent model?

If you follow my blog post carefully, you will see that they are validated within their own model. This part is a bit of a hack because Yii does not have the facility to do it really nicely. I believe I may have run into exactly the same issue you are having when I tried to validate within the parent module.

Please follow my blog post very carefully.

Hello. I am sorry for the late reply. Thank you for your fast reply. I have managed to validate the attributes and have my application running smoothly using your extension. Thank you for your help :)