protected function storeTranslationsForFieldValidation(Field $field)
    {
        if (false === $this->translationsForFieldValidationWereInjected($field)) {
            $fieldName = $field->getName();

            foreach ($field->getValidation() as $validationName => $validation) {
                $messages = ValidatorService::get()->getValidatorMessages($validation->getClassName(), $validation->getMessages());

                foreach ($messages as $key => $message) {
                    $message = MessageService::get()->parseMessageArray($message, ['{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}']);

                    $localizationKey = $this->getIdentifierForFieldValidationName($field, $validationName, $key);
                    $this->addTranslation($localizationKey, $message);
                    $messages[$key] = $localizationKey;
                }

                $this->translationKeysForFieldValidation[$fieldName . '-' . $validationName] = $messages;

                $key = $this->getFormObject()->getClassName() . '-' . $field->getName();
                $this->injectedTranslationKeysForFieldValidation[$key] = true;
            }
        }

        return $this;
    }
protected function storeTranslationsForFieldValidation(Field $field)
    {
        if (false === $this->translationsForFieldValidationWereInjected($field)) {
            $fieldName = $field->getName();

            foreach ($field->getValidation() as $validationName => $validation) {
                $messages = ValidatorService::get()->getValidatorMessages($validation->getClassName(), $validation->getMessages());

                foreach ($messages as $key => $message) {
                    $message = MessageService::get()->parseMessageArray($message, ['{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}']);

                    $localizationKey = $this->getIdentifierForFieldValidationName($field, $validationName, $key);
                    $this->addTranslation($localizationKey, $message);
                    $messages[$key] = $localizationKey;
                }

                $this->translationKeysForFieldValidation[$fieldName . '-' . $validationName] = $messages;

                $key = $this->getFormObject()->getClassName() . '-' . $field->getName();
                $this->injectedTranslationKeysForFieldValidation[$key] = true;
            }
        }

        return $this;
    }
protected function storeTranslationsForFieldValidation ( Field $ field ) { if ( false === $ this -> translationsForFieldValidationWereInjected ( $ field ) ) { $ fieldName = $ field -> getName ( ) ; foreach ( $ field -> getValidation ( ) as $ validationName => $ validation ) { $ messages = ValidatorService :: get ( ) -> getValidatorMessages ( $ validation -> getClassName ( ) , $ validation -> getMessages ( ) ) ; foreach ( $ messages as $ key => $ message ) { $ message = MessageService :: get ( ) -> parseMessageArray ( $ message , [ '{0}' , '{1}' , '{2}' , '{3}' , '{4}' , '{5}' , '{6}' , '{7}' , '{8}' , '{9}' , '{10}' ] ) ; $ localizationKey = $ this -> getIdentifierForFieldValidationName ( $ field , $ validationName , $ key ) ; $ this -> addTranslation ( $ localizationKey , $ message ) ; $ messages [ $ key ] = $ localizationKey ; } $ this -> translationKeysForFieldValidation [ $ fieldName . '-' . $ validationName ] = $ messages ; $ key = $ this -> getFormObject ( ) -> getClassName ( ) . '-' . $ field -> getName ( ) ; $ this -> injectedTranslationKeysForFieldValidation [ $ key ] = true ; } } return $ this ; }
Will loop on each validation rule of the given field, and get the
translations of the rule messages.

@param Field $field
@return $this
Will loop on each validation rule of the given field and get the translations of the rule messages .