How to add rule for resx to mark variables {0}, {1} etc. non-translatable and display non-translatable <comment>?

How can I add rule for parsing resx to mark variables {0}, {1} etc. non-translatable and display non-translatable <comment>?

I added the two rules to standard XML Microsoft .NET resources format and I tried to generate a custom file type for resx but the result is the same.

(The source file is attached zipped, otherwise it would not upload.)

Trados Studio project settings showing parser rules for XML Microsoft .NET resources with non-translatable variables and comments highlighted.3858.Resource2.zipTrados Studio options menu with parser rules for resx file type, highlighting non-translatable elements for variables and comments.Preview of resx file in Trados Studio with variables 0, 1 displayed as non-translatable in the source and target columns.



Generated Image Alt-Text
[edited by: Trados AI at 4:21 AM (GMT 0) on 5 Mar 2024]
emoji
Parents Reply Children
  • Well done so far... you did the hardest part!!

    The comments seem to be within <comment> elements.  So here you only need to add a new parser rule to extract them.  It's not possible to extract them and have them displayed as messages/comments so instead you should be able to add the new parser rule for comments, give it some structure (comment for example), and then you can filter on the comment structure using the Advanced Display Filter, copy source to target if it doesn't need to be translated, and lock it.  This way you can always see the comments as you work but they won't get in the way of translating.

    However, I just tested this and the problem is that when you also use the embedded content filter the document structure information is removed!  I believe this is a bug that is already known but I'll make sure to report it anyway.

    So, what can you do now?  Maybe a workaround like this and forget about using the embedded content filetype:

    1. create your new parser rule and add the appropriate structure:


    2. You should now have something like this:


    3. Filter on the comments, copy source to target and lock:


    4. So now you have this, which seem workable and clean:
    5. To handle the variables now I would use something like the SDL Data Protection Suite like this:


    6. Now on running the task I get this:

    Once complete don't forget to "unprotect" the file before saving the target.

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

  • , thanks a lot! I have managed to:

    - Keep the previous Parser rules + marking <comment> as translatable

    - Keep the previous Embedded content setting that protects {\d+}

    - Still use the Community Advanced Display Filter to select COM segments and lock them!

    This truly looks workable and clean, however it puts some pre- and post-processing effort at document level, while ideally I'd get it all done at file type definition level Slight smile

    Regards and thank you!

    Marta Bartnicka

    PS. I could not get "Protect Data" under Batch Processing, however I've installed SDL Data Protection Suite :(

  • I could not get "Protect Data" under Batch Processing, however I've installed SDL Data Protection Suite :(

    What do you see when you run the batch tasks?  So in the menu for selecting a Batch Task?

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

  • Ahh, there IS "Protect Data" when I select a Batch Task so I guess I could add the processing there.

    But I really want to get done as much as possible under custom File Type, and the embedded content filter is getting it right Slight smile

    So thank you, I got resx custom-handled as good as possible!

    Regards,

    Marta