From ddaa268323e1d9d11c144d17fe94aae31b6f177c Mon Sep 17 00:00:00 2001 From: mikolaj Date: Fri, 21 Apr 2023 16:27:18 +0200 Subject: [PATCH] IBX-5565: Fixed issue with translation extraction --- .../Resources/translations/content_type.en.xliff | 5 +++++ .../FieldType/Mapper/UserAccountFormMapper.php | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/bundle/Resources/translations/content_type.en.xliff b/src/bundle/Resources/translations/content_type.en.xliff index 3d88774b02..b1a6261e8f 100644 --- a/src/bundle/Resources/translations/content_type.en.xliff +++ b/src/bundle/Resources/translations/content_type.en.xliff @@ -836,6 +836,11 @@ Password must not be contained in a public breach. key: field_definition.ezuser.require_not_compromised_password + + This uses the API at %link% to securely check breach data. The password is not transmitted to the API. + This uses the API at %link% to securely check breach data. The password is not transmitted to the API. + key: field_definition.ezuser.require_not_compromised_password_help + Email must be unique Email must be unique diff --git a/src/lib/FieldType/Mapper/UserAccountFormMapper.php b/src/lib/FieldType/Mapper/UserAccountFormMapper.php index 88054c6d0a..3abbe31cd1 100644 --- a/src/lib/FieldType/Mapper/UserAccountFormMapper.php +++ b/src/lib/FieldType/Mapper/UserAccountFormMapper.php @@ -9,6 +9,8 @@ use Ibexa\AdminUi\FieldType\FieldDefinitionFormMapperInterface; use Ibexa\AdminUi\Form\Data\FieldDefinitionData; use Ibexa\ContentForms\Form\Type\FieldDefinition\User\PasswordConstraintCheckboxType; +use JMS\TranslationBundle\Model\Message; +use JMS\TranslationBundle\Translation\TranslationContainerInterface; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symfony\Component\Form\Extension\Core\Type\TextType; @@ -19,7 +21,7 @@ /** * Maps a user FieldType. */ -final class UserAccountFormMapper implements FieldDefinitionFormMapperInterface +final class UserAccountFormMapper implements FieldDefinitionFormMapperInterface, TranslationContainerInterface { /** * {@inheritdoc} @@ -52,9 +54,7 @@ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, Field 'property_path' => $validatorPropertyPathPrefix . '[requireNotCompromisedPassword]', 'label' => /** @Desc("Password must not be contained in a public breach.") */ 'field_definition.ezuser.require_not_compromised_password', - 'help' => /** @Desc("This uses the API at %link% to securely check breach data. - * The password is not transmitted to the API.") */ - 'field_definition.ezuser.require_not_compromised_password_help', + 'help' => 'field_definition.ezuser.require_not_compromised_password_help', 'help_translation_parameters' => [ '%link%' => 'https://haveibeenpwned.com/', ], @@ -119,6 +119,14 @@ public function configureOptions(OptionsResolver $resolver) 'translation_domain' => 'content_type', ]); } + + public static function getTranslationMessages(): array + { + return [ + Message::create('field_definition.ezuser.require_not_compromised_password_help', 'content_type') + ->setDesc('This uses the API at %link% to securely check breach data. The password is not transmitted to the API.'), + ]; + } } class_alias(UserAccountFormMapper::class, 'EzSystems\EzPlatformAdminUi\FieldType\Mapper\UserAccountFormMapper');