daniel-sc / ng-extract-i18n-merge

Extract and merge i18n xliff translation files for angular projects.
MIT License
175 stars 18 forks source link

self closing tags with newTranslationTargetsBlank #117

Open 10eputzen opened 2 weeks ago

10eputzen commented 2 weeks ago

After extracting the translations into my xlf file, the content looks like this:

    <trans-unit id="6575195871133210332" datatype="html">
        <source>Orders</source>
        <target state="new"/>
      </trans-unit>

but I would expect it to look like this (wtihout self-closing empty tags):

   <trans-unit id="6575195871133210332" datatype="html">
        <source>Orders</source>
        <target state="new"></target>
     </trans-unit>

Here is my angular.json:

   "extract-i18n": {
          "builder": "ng-extract-i18n-merge:ng-extract-i18n-merge",
          "options": {
            "buildTarget": "myApp:build",
            "format": "xlf",
            "outputPath": "src/locale",
            "targetFiles": ["messages.de.xlf"],
            "newTranslationTargetsBlank": true
          }
        },
daniel-sc commented 1 week ago

Hi @10eputzen this will probably be a little difficult to implement, as the serialization relies on https://github.com/nfarina/xmldoc which has no configuration for this. Probably some post processing with regex/search-replace could solve this for most/all cases.

Bevor jumping into implementation, may I ask why this is relevant for you? Both serializations should be handled by all xml tooling in the same way?

10eputzen commented 1 week ago

I am currently evaluating how use the angular translations in the most efficient way. And having an empty tag would basically just save me a mousclick and a keyboard stroke (to open the tag and enter text) as it is easier just to click inside the empty tag. So it is really first world problem and I wouldn't give it a high priority, especially if it is difficult to implement. But I appreciate you getting back to me.