schmittjoh / JMSTranslationBundle

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

XLIFF 1.2 attributes (state, approved and others) are not respected #478

Open mcorteel opened 6 years ago

mcorteel commented 6 years ago
Q A
Bundle version 1.3.2
Symfony version 3.4.3
PHP version 7.2.1

Let's say that I have the string "Hello wold" in my project. Extracting it with php bin/console translation:extract will output the following <trans-unit>:

<trans-unit id="[some_id]" resname="Hello world">
         <source>Hello world</source>
         <target>Hello world</target>
         <jms:reference-file line="[some_line]">[some_file]</jms:reference-file>
</trans-unit>

Now, I translate it with lokalize and get:

<trans-unit approved="yes" resname="Hello world" id="[some_id]">
         <source>Hello world</source>
         <target phase-name="approval-1" state="signed-off">Bonjour le monde</target>
         <jms:reference-file line="[some_line]">[some_file]</jms:reference-file>
</trans-unit>

Now, I want to extract my translation again, and...

Expected behavior

<trans-unit approved="yes" resname="Hello world" id="[some_id]">
         <source>Hello world</source>
         <target phase-name="approval-1" state="signed-off">Bonjour le monde</target>
         <jms:reference-file line="[some_line]">[some_file]</jms:reference-file>
</trans-unit>

Actual behavior

<trans-unit resname="Hello world" id="[some_id]">
         <source>Hello world</source>
         <target>Bonjour le monde</target>
         <jms:reference-file line="[some_line]">[some_file]</jms:reference-file>
</trans-unit>

Conclusion

I would like the extractor to keep the approved, phase-name and state attributes which are essential to a good i18n workflow. Is that at all possible? I have no idea how the extractor works with the pre-existing state of translations but that would really make the translation files more usable. Any thoughts on this issue?

Anyway, thanks for a great bundle!