Skip to content

Commit

Permalink
IBX-5565: Fixed issue with translation extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
mikadamczyk committed Apr 21, 2023
1 parent a1fb0b6 commit ddaa268
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/bundle/Resources/translations/content_type.en.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,11 @@
<target state="new">Password must not be contained in a public breach.</target>
<note>key: field_definition.ezuser.require_not_compromised_password</note>
</trans-unit>
<trans-unit id="73a71072b428bec8a32c4ca1cf4813314b2a783d" resname="field_definition.ezuser.require_not_compromised_password_help">
<source>This uses the API at %link% to securely check breach data. The password is not transmitted to the API.</source>
<target state="new">This uses the API at %link% to securely check breach data. The password is not transmitted to the API.</target>
<note>key: field_definition.ezuser.require_not_compromised_password_help</note>
</trans-unit>
<trans-unit id="100096c9b93ce532e7bf2f184d8e3f43374ae921" resname="field_definition.ezuser.require_unique_email">
<source>Email must be unique</source>
<target state="new">Email must be unique</target>
Expand Down
16 changes: 12 additions & 4 deletions src/lib/FieldType/Mapper/UserAccountFormMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,7 +21,7 @@
/**
* Maps a user FieldType.
*/
final class UserAccountFormMapper implements FieldDefinitionFormMapperInterface
final class UserAccountFormMapper implements FieldDefinitionFormMapperInterface, TranslationContainerInterface
{
/**
* {@inheritdoc}
Expand Down Expand Up @@ -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%' => '<a href="https://haveibeenpwned.com/" target="_blank">https://haveibeenpwned.com/</a>',
],
Expand Down Expand Up @@ -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');

0 comments on commit ddaa268

Please sign in to comment.