Tuesday, 6 September 2011

cakephp1.3 multilingual validation

Cakephp1.3 Multilingual  Validation



Website which is multilingual, messages will be also multilingual. To set the different error message follow the below some simple steps.

Paste following code in app_model.php
Code:
        function invalidate($field, $value = null) { 

        if (!is_array($this->validationErrors)) { 

            $this->validationErrors = array(); 

        } 

        if(empty($value)) { 

            $value = true; 

        } 

        $this->validationErrors[$field] = __($value,  true);         

    }

field collation in database must be "utf8_unicode_ci"