schmittjoh / JMSTranslationBundle

Puts the Symfony2 Translation Component on steroids
http://jmsyst.com/bundles/JMSTranslationBundle
426 stars 292 forks source link

Extract validators messages while using All Constraint @Assert\All #450

Open plPubel opened 7 years ago

plPubel commented 7 years ago
Q A
Bundle version 1.1.0-DEV
Symfony version 3.3.2
PHP version 7.0

While using All Constraint source validation messages aren't extracted.

Expected behavior

<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
  <file date="2017-07-12T11:23:29Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
    <header>
      <tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
      <note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
    </header>
    <body>
    <trans-unit id="93241dfaa3aa151ae7e5ddc052bab7c9178c2a6c" resname="acme.maxSize {{ limit }} {{ suffix }}">
        <source>acme.maxSize</source>
        <target>File is too large. Max size {{ limit }} {{ suffix }}</target>
        <jms:reference-file line="22">...</jms:reference-file>
    </trans-unit>
    <trans-unit id="308ce36466512c0148bdcda1182091de0824e6c7" resname="acme.typeMessage">
        <source>acme.typeMessage</source>
        <target>Unsupported file extension</target>
        <jms:reference-file line="24">...</jms:reference-file>
    </trans-unit>
    <trans-unit id="edebf69a6416d3d607860ed7ff112b8e8f955d9b" resname="acme.fileBlank">
        <source>acme.fileBlank</source>
        <target>It looks that file is empty</target>
        <jms:reference-file line="22">...</jms:reference-file>
    </trans-unit>
    </body>
  </file>
</xliff>

Actual behavior

No output

Steps to reproduce

Example annotation

/**
* @ORM\Column(type="array")
* @Assert\All({
*     @Assert\NotBlank(
*         message="acme.fileBlank"
*     ),
*     @Assert\File(
*         maxSize = "5M",
*         maxSizeMessage = "acme.maxSize {{ limit }} {{ suffix }}",
*         mimeTypes = { "image/jpeg", "application/pdf" },
*         mimeTypesMessage = "acme.typeMessage"
*     ),
* })
*/