/**
  * Checks if the passed value is valid.
  *
  * @param LanguageCreateStruct $value The value that should be validated
  * @param Constraint|UniqueFieldDefinitionIdentifier $constraint The constraint for the validation
  *
  * @api
  */
 public function validate($value, Constraint $constraint)
 {
     if (!$value instanceof LanguageCreateStruct) {
         return;
     }
     try {
         $language = $this->languageService->loadLanguage($value->languageCode);
         if ($language->id == $value->getId()) {
             return;
         }
         $this->context->buildViolation($constraint->message)->atPath('language_code')->setParameter('%language_code%', $value->languageCode)->addViolation();
     } catch (NotFoundException $e) {
         // Do nothing
     }
 }
 /**
  * Loads a Language from its language code ($languageCode)
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if language could not be found
  *
  * @param string $languageCode
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Language
  */
 public function loadLanguage($languageCode)
 {
     return $this->service->loadLanguage($languageCode);
 }