Beispiel #1
0
 /**
  * @return \Symfony\Component\Validator\Constraint[]
  */
 protected function createGlossaryKeyConstraints()
 {
     $constraints = $this->getFieldDefaultConstraints();
     $constraints[] = new Callback(['methods' => [function ($glossaryKey, ExecutionContextInterface $contextInterface) {
         if ($this->glossaryFacade->hasKey($glossaryKey)) {
             $contextInterface->addViolation('Translation key already exists.');
         }
     }], 'groups' => [self::GROUP_UNIQUE_GLOSSARY_KEY_CHECK]]);
     return $constraints;
 }
 /**
  * @param string $keyName
  * @param \Generated\Shared\Transfer\LocaleTransfer $locale
  *
  * @return \Generated\Shared\Transfer\TranslationTransfer
  */
 public function getTranslation($keyName, LocaleTransfer $locale)
 {
     return $this->glossaryFacade->getTranslation($keyName, $locale);
 }
 /**
  * @param string $keyName
  *
  * @return bool
  */
 public function hasKey($keyName)
 {
     return $this->glossaryFacade->hasKey($keyName);
 }
 /**
  * @param string $keyName
  * @param array $data
  *
  * @return string
  */
 public function translate($keyName, array $data = [])
 {
     return $this->glossaryFacade->translate($keyName, $data);
 }
Beispiel #5
0
 /**
  * @param int $idKey
  * @param \Generated\Shared\Transfer\LocaleTransfer|null $localeTransfer
  *
  * @return void
  */
 public function touchTranslationForKeyId($idKey, LocaleTransfer $localeTransfer = null)
 {
     $this->glossaryFacade->touchTranslationForKeyId($idKey, $localeTransfer);
 }