protected function validateTranslation()
    {
        $translations = $this->getSubmitted('translation');

        if (empty($translations)) {
            return null;
        }

        $lengths = array(
            'meta_title' => 60,
            'meta_description' => 160
        );

        foreach ($translations as $lang => $translation) {
            foreach ($translation as $field => $value) {

                if ($value === '') {
                    unset($translations[$lang][$field]);
                    continue;
                }

                $max = isset($lengths[$field]) ? $lengths[$field] : 255;

                if (mb_strlen($value) > $max) {
                    $label = ucfirst(str_replace('_', ' ', $field));
                    $this->setErrorLengthRange("translation.$lang.$field", $label, 0, $max);
                }
            }

            if (empty($translations[$lang])) {
                unset($translations[$lang]);
            }
        }

        $this->setSubmitted('translation', $translations);
        return !$this->isError('translation');
    }
protected function validateTranslation()
    {
        $translations = $this->getSubmitted('translation');

        if (empty($translations)) {
            return null;
        }

        $lengths = array(
            'meta_title' => 60,
            'meta_description' => 160
        );

        foreach ($translations as $lang => $translation) {
            foreach ($translation as $field => $value) {

                if ($value === '') {
                    unset($translations[$lang][$field]);
                    continue;
                }

                $max = isset($lengths[$field]) ? $lengths[$field] : 255;

                if (mb_strlen($value) > $max) {
                    $label = ucfirst(str_replace('_', ' ', $field));
                    $this->setErrorLengthRange("translation.$lang.$field", $label, 0, $max);
                }
            }

            if (empty($translations[$lang])) {
                unset($translations[$lang]);
            }
        }

        $this->setSubmitted('translation', $translations);
        return !$this->isError('translation');
    }
protected function validateTranslation ( ) { $ translations = $ this -> getSubmitted ( 'translation' ) ; if ( empty ( $ translations ) ) { return null ; } $ lengths = array ( 'meta_title' => 60 , 'meta_description' => 160 ) ; foreach ( $ translations as $ lang => $ translation ) { foreach ( $ translation as $ field => $ value ) { if ( $ value === '' ) { unset ( $ translations [ $ lang ] [ $ field ] ) ; continue ; } $ max = isset ( $ lengths [ $ field ] ) ? $ lengths [ $ field ] : 255 ; if ( mb_strlen ( $ value ) > $ max ) { $ label = ucfirst ( str_replace ( '_' , ' ' , $ field ) ) ; $ this -> setErrorLengthRange ( "translation.$lang.$field" , $ label , 0 , $ max ) ; } } if ( empty ( $ translations [ $ lang ] ) ) { unset ( $ translations [ $ lang ] ) ; } } $ this -> setSubmitted ( 'translation' , $ translations ) ; return ! $ this -> isError ( 'translation' ) ; }
Validates category translations
@return boolean|null
Validates category translations