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

Do not mark trans-units with 'needs-adaptation' if 'xliffSync.parseFromDeveloperNoteOverwrite' = true #119

Closed fvet closed 1 month ago

fvet commented 1 year ago

@rvanbekkum In some of our apps, NL and EN translations are provided by the developer via AL code (using the 'comment = ' solution). What we would like to achieve for these apps, is that the single source of truth for translations is always the AL code, so the developer should not really bother on how the xliff content is updated, since all translations originate from code. Just syncing translation files should be sufficient.

The project settings look like:

"xliffSync.autoCheckMissingTranslations": true,
    "xliffSync.autoCheckNeedWorkTranslations": true,
    "xliffSync.needWorkTranslationRules": [
        "OptionMemberCount",
        "OptionLeadingSpaces",
        "Placeholders",
        "ConsecutiveSpacesConsistent",
        "ConsecutiveSpacesExist"
    ],
    "xliffSync.parseFromDeveloperNote": true,   // !!
    "xliffSync.parseFromDeveloperNoteOverwrite": true,   // !!
    "xliffSync.parseFromDeveloperNoteSeparator": "||",
    "xliffSync.findBySource": true,
    "xliffSync.findBySourceAndDeveloperNote": true,
    "xliffSync.parseFromDeveloperNoteTrimCharacters": "\"",
    "xliffSync.preserveTargetAttributesOrder": true,

However, if I adapt a caption, tooltip, ....

E.g. before

ToolTip = 'When active, the line discount will be given on the direct unit cost including excise.', Comment = 'nl-BE="Indien actief zal de regelkorting gegeven worden op de directe kostprijs inclusief accijns."';

after

ToolTip = 'When active, the line discount will be given on the direct unit cost including excise (see manual for more information).', Comment = 'nl-BE="Indien actief zal de regelkorting gegeven worden op de directe kostprijs inclusief accijns (zie handleiding voor meer informatie)."';

Then after packaging my app, and syncing the translation files, the related trans-unit id are marked as needs-adaptation. To me, this looks wrong, as the project settings specify that translations should be overwritten by the DeveloperNotes, so no need to review I'd suppose. Any thoughts on this?

 <trans-unit id="PageExtension 4150078002 - Control 2219526984 - Property 1295455071" size-unit="char" translate="yes" xml:space="preserve" al-object-target="Page 2965669802">
          <source>When active, the line discount will be given on the direct unit cost including excise (see manual for more information).</source>
          <target state="needs-adaptation">Indien actief zal de regelkorting gegeven worden op de directe kostprijs inclusief accijns (zie handleiding voor meer informatie).</target>
          <note from="XLIFF Sync" annotates="general" priority="1">Source text has changed. Please review the translation.</note>
          <note from="Developer" annotates="general" priority="2">nl-BE="Indien actief zal de regelkorting gegeven worden op de directe kostprijs inclusief accijns (zie handleiding voor meer informatie)."</note>
          <note from="Xliff Generator" annotates="general" priority="3">PageExtension ESCEBlanketPurchaseOrder - Control ESCE Line Disc. Excise - Property ToolTip</note>
        </trans-unit>
rvanbekkum commented 1 month ago

Hi @fvet, It's been quite some time since you have reported this issue.

Just wanted to let you know that it seems to be that it's just that you are missing a setting: xliffSync.detectSourceTextChanges should be set to false if you don't want the state to change when the source text changes

I will add this to the README so that other people won't get confused in the future.