jwikman / nab-al-tools

The code repository for NAB AL Tools, an AL tool for VS Code
https://marketplace.visualstudio.com/items?itemName=nabsolutions.nab-al-tools
MIT License
19 stars 8 forks source link

"NAB: REVIEW" tag is always added to target when source is empty when "Refresh XLF files" #469

Open RadoArvay opened 2 weeks ago

RadoArvay commented 2 weeks ago

Describe the bug [NAB: REVIEW] tag is always added to target element, when source is "empty" (contains spaces) when "Refresh XLF files from g" is run. It ignores any state of target. I think it is not very suitable behavior. Before run of Refresh:

          <source> </source>
          <target state="final"> </target>

After run of Refresh:

          <source> </source>
          <target state="final">[NAB: REVIEW] </target>

Versions used NAB AL Tools: v1.33.409221951 (pre-release)

jwikman commented 1 week ago

Hi, sorry for the late reply - I obviously missed this one.

I believe that this is a feature, not a bug. 🙂

Don't you also get the note from our tool? <note from="NAB AL Tool Refresh Xlf" annotates="general" priority="3">Source contains only white-space, consider using 'Locked = true' to avoid translation of unnecessary texts. This note can be toggled with the setting 'NAB.PreferLockedTranslations'.</note>

As mentioned, you can toggle this feature off if you prefer, but I suggest that you use Locked = true when having an empty text.

But your concern might have to do with the state property? It is only considered by the tool if the NAB.UseExternalTranslationTool (naming isn't optimal, as an external translation tool is not mandatory for this...) setting is activated. If that is activated, the state is modified instead of using [NAB: ] tags in the target.

RadoArvay commented 1 week ago

Yes, we do, we get that note. But there are situations like:

Now, we need to check tags like [NAB: REVIEW] everytime we do a sync from G-file. It already happened once we published the app with translation containing [NAB: REVIEW] text.

I have not done tests yet - so, right now, the solution is to use UseExternalTranslationTool option? It changes state instead of adding the tag? Do I understand it well? Or is there another way to avoid that?

jwikman commented 1 week ago

Ok, now I see. And you actually helped me to find a bug, but not really the one described. (at least my interpretation of it 🙂)

If configuring "NAB.UseExternalTranslationTool": true and "NAB.PreferLockedTranslations": true (the default value), the [NAB: REVIEW] tag is added - no matter what state value there is. This is a bug, and should be fixed. So, using NAB.UseExternalTranslationTool won't help you here (yet).

The solution to your issue is to set "NAB.PreferLockedTranslations": false to switch of this feature where empty source is not allowed.

Using [NAB: ] tags or the state attribute is a matter of taste and routines.

RadoArvay commented 1 week ago

Using [NAB: ] tags or the state attribute is a matter of taste and routines.

maybe yes, maybe no ;-)

As a wrote in the 2nd point...a flow is like: we translate something; we are sure of it; so the most logic way is to set the state (as many tools support it); we do not want to come back to that translation and review it; an app was updated; G-sync is done; new entries are added (with a state to translate).......it is easy to forget to review NAB tags.

Okay, I will try different configurations and "routines".

jwikman commented 1 week ago

Using [NAB: ] tags or the state attribute is a matter of taste and routines.

maybe yes, maybe no ;-)

What I meant, was that the tool supports (with the above-mentioned bug) either one way or the other. When working with [NAB:] tags, the tool does not care about the state attribute. And when working with the state attribute, the tool should not use [NAB:] tags. 🙂

Yes, please try out the PreferLockedTranslations setting first, it should take away some annoyance. And then you can optionally test the UseExternalTranslationTool setting to see what fits your need the best.