original_string: 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');
      }
code: 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');
      }
code_tokens: 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' ) ; }
docstring: Validates category translations
  @return boolean|null
docstring_tokens: Validates category translations