Skip to content

Commit

Permalink
Added proper translation message
Browse files Browse the repository at this point in the history
  • Loading branch information
tbialcz committed Oct 7, 2024
1 parent cea2375 commit 34e35bd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/bundle/Resources/translations/validators.en.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
<note>key: ezplatform.trash.location_has_no_children</note>
</trans-unit>
<trans-unit id="ea852842b560d609441b8470b79735f2dc91698f" resname="ibexa.language.language_code.format">
<source>The Language code {{ value }} contains illegal characters. Language code should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").").</source>
<target state="new">The Language code {{ value }} contains illegal characters. Language code should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").").</target>
<source>The Language code {{ value }} contains illegal characters. Language code should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores, hyphens and colons.</source>
<target state="new">The Language code {{ value }} contains illegal characters. Language code should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores, hyphens and colons.</target>
<note>key: ibexa.language.language_code.format</note>
</trans-unit>
<trans-unit id="cf558f546b83d94f1272929f81c64bd33d2997bc" resname="js.error.address_not_found">
Expand Down
14 changes: 13 additions & 1 deletion src/lib/Form/Data/Language/LanguageCreateData.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

namespace Ibexa\AdminUi\Form\Data\Language;

use JMS\TranslationBundle\Model\Message;
use JMS\TranslationBundle\Translation\TranslationContainerInterface;
use Symfony\Component\Validator\Constraints as Assert;

class LanguageCreateData
class LanguageCreateData implements TranslationContainerInterface
{
/**
* @var string
Expand Down Expand Up @@ -92,6 +94,16 @@ public function setEnabled(bool $enabled): self

return $this;
}

public static function getTranslationMessages(): array
{
return [
Message::create('ibexa.language.language_code.format', 'validators')
->setDesc(
'The Language code {{ value }} contains illegal characters. Language code should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores, hyphens and colons.'
),
];
}
}

class_alias(LanguageCreateData::class, 'EzSystems\EzPlatformAdminUi\Form\Data\Language\LanguageCreateData');

0 comments on commit 34e35bd

Please sign in to comment.