rvanbekkum / vsc-xliff-sync

Visual Studio Code extension that allows for automatic merging of (simple) XLIFF translation files.
MIT License
23 stars 4 forks source link

[Feature request] XLF file validation #10

Closed fvet closed 5 years ago

fvet commented 5 years ago

It would be intesting if the XLIFF sync could also provide support to check the 'technical' quality of the translations:

These are issues partners / translators might struggle with and could results in wrong behaviour of the app.

Kind of the same rules we had in mergetool.com, calculate technical check comment...

In fact, MS should ensure these rules are in place when publishing / building an app, but I guess the Idea would dissappear in their backlog ...

rvanbekkum commented 5 years ago

Great idea! I will look into this.

rvanbekkum commented 5 years ago

I have added the initial implementation for this in feature branch feature/10-technical-checks.

This introduces a command XLIFF: Check for Need Work Translations, which will compare the source and translation text for each .xlf target file and run the checks you suggested above. For each unit in which a problem is detected, the target-node is tagged with state=needs-adaptation and a note will be added to notify the translator about the detected problem. For example:

<trans-unit id="Table 2739814070 - Field 3834966961 - Property 62802879" size-unit="char" translate="yes" xml:space="preserve">
  <source>A,B,C</source>
  <target state="needs-adaptation">A,B,C,D</target>
  <note from="XLIFF Sync" annotates="general" priority="1">Problem detected: The number of option members in the source and translation text do not match.</note>
  <note from="Developer" annotates="general" priority="2"/>
  <note from="Xliff Generator" annotates="general" priority="3">Table MyDummyTable - Field MyOption - Property OptionCaption</note>
</trans-unit>

Running the command again after resolving the problem will also remove the note that was added automatically. You can also have the extension automatically perform these checks directly after you synchronize by enabling the new setting xliffSync.autoCheckNeedWorkTranslations. See the README.md for more information.

@fvet Could you please check and let me know what you think about this? After that I will merge it into the master branch and make a new release.

fvet commented 5 years ago

@rvanbekkum , this is what I had in mind, would be glad to test the new feature and provide feedback!

rvanbekkum commented 5 years ago

I have created a new 0.1.6 release. If you have feedback, please let me know!