DanielNT / ALTranslationCenter

Extension for improving speed in multilanguage developing with AL Language.
0 stars 0 forks source link

Labels with additional non translation comments cause an error #17

Open hhfiddelke opened 2 days ago

hhfiddelke commented 2 days ago

if you have a label, f.e.: CodeunitErr: Label 'There is no processing Codeunit defined for Profile %1', Comment = 'DEU="Für Profil %1 ist keine Bearbeitungs-Codeunit definiert.", %1=Profile Code';

with a comment that also explains a placeholder or something different, the translation tool fires an exception.

It should only use the the text that is formatted according to the translation syntax 'DEU="ABC",ENU="YXZ"' and ignore the rest.

DanielNT commented 2 days ago

Hi @hhfiddelke.

I tested with Skip % only prefix option, and your example does not work well, I think that valid syntax with "%" is something like:

CodeunitErr: Label 'There is no processing Codeunit defined for Profile %1', Comment = 'DEU="Für Profil %1 ist keine Bearbeitungs-Codeunit definiert.",%1="Profile Code"';

hhfiddelke commented 1 day ago

Thank you, for your tip, that seems to work. Unfortunately does Microsoft not provide any documentation about how to format and structure comments, so the only documentation i found was https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/analyzers/codecop-aa0470 does not recommend your description.

So i can live with the restriction, but if you can spent some time on improvements, it would be nice ATC would ignore anything in a comment beginning with the first % or not starting with a Language Code .

DanielNT commented 1 day ago

You are absolutely right, the recommended syntax for detailing "%" is not the same. The problem is that, for getting translations and detecting possible errors, the string must be splitted. The trouble could be that changing it may throw false positive errors, or split the translation incorrectly in some cases, if it includes %1, %2, etc. in translations.

I will check it when I have free time, and maybe add a new experimental option.

Thanks.