How to make attributes of a HTML tag translatable? (Trados 2022)

Hello,

I have a HTML file which is recognized as XHTML 1.1 V 1.2. These files contain <a>-Tags which look like this:

<a contenteditable="false" data-primary="design" data-secondary="stress testing ideas for desirability" data-tertiary="building better products" data-type="indexterm" id="Dstressbetter02">&nbsp;</a>

Now I want to access the attributes and translate them in Trados (they are indexterms of a book).

I tried to change the parser of file type HTML 5, tag <a>, accordingly but to no avail. (I believe this is the right one, called from XHTML 1.1?)

I hope that I could tell Trados to make individual attributes of the tag accessible and translatable by

- changing the correct properties of the a tag here

- adding the atttributes to the list and make them translatable.

But it just doesn't work. What am I doing wrong? :-)

Trados Studio Edit Rule dialog box showing properties for inline tag with attributes 'href' and 'target' set to not translate.

Many thanks for any tipps or help!!



Generated Image Alt-Text
[edited by: Trados AI at 7:46 AM (GMT 0) on 29 Feb 2024]
emoji
  •   

    I can only assume the following:

    1. you are not editing the right rule
    2. you have not added the attributes you have to translate

    I tested with this:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "www.w3.org/.../xhtml11.dtd">
    <html xmlns="www.w3.org/.../xhtml">
    <head>
    <title>Jens Test</title>
    </head>
    <body>
    <a contenteditable="false" data-primary="design" data-secondary="stress testing ideas for desirability" data-tertiary="building better products" data-type="indexterm" id="Dstressbetter02">·</a>
    </body>
    </html>
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    And get this:

    Trados Studio preview showing HTML content with titles 'Jens Test', 'stress testing ideas for desirability', and 'building better products'.

    I just edited the "a" parser rule and added "data-secondary" and "data-tertiary" as new translatable attributes.

    Trados Studio parser options with 'a' tag selected, showing it is translatable but not protected content.

    Trados Studio edit rule window for 'a' tag, with 'data-secondary' and 'data-tertiary' attributes set to translatable.

    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



    Generated Image Alt-Text
    [edited by: Trados AI at 7:46 AM (GMT 0) on 29 Feb 2024]
  • Hi Paul,

    thanks, that is exactly what (at least I thought) I did. But will check again.

    But I also found that my source HTML just starts with:

    <section data-type="chapter" id="stress_test_your_idea_for_desirability" xmlns="">www.w3.org/.../xhtml">
    <h1>Stress Test Your Idea for Desirability</h1>

    and has no DOCTYPE settings. So maybe another file type (parser) is at work here an not the XHTML 1.1?

    Or maybe I have a glitch in my workflow. Do I have to completely re-import my HTML source or is it sufficient to export from .sdlxliff back to target file .html and the re-open after I changed a rule?

    Or do I have to change any program option and not just the rule in the project file type settings?

    Scratching head ... :-)

    emoji
  •  

    Why don't you help me to help you and just cut down your file so you can provide me with a fully formed example of what you have.  Providing me with the odd snippets here and there isn't helpful as I have to guess and make up the files to test for you.

    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

    emoji
  • I'm sorry!

    I stripped down a file, here is a shared Onedrive link:

    Test file

    I also checked again that the file type parser settings are the same as in your screenshots. They are, I checked both the general options as well as the project settings, they are both identical.

    Can I get you any more helpful information?

    emoji
  •  

    I used your file with the same settings I used before and get this:

    Screenshot of Trados Studio preview showing text with highlighted tags such as 'a' and 'em' indicating correct parser rule settings.

    Which looks fine to me.  So lets tackle the more basic questions just in case:

    1. did you do this in your Project Settings or in File Options?
    2. if you use the preview feature in the filetype view it will show you the same view as me if you have the same settings, perhaps check using that feature first

    And just to revisit this:

    thanks, that is exactly what (at least I thought) I did. But will check again.

    You definitely did not do the same thing based on your screenshot.  You had this:

    Screenshot of Trados Studio parser rule settings with empty fields for 'Tag name' and 'Conditions'.

    So you have not edited the "a" parser rule.  Please check there as well.  Also double check in here that you have added the attributes in question as you have not shown them in your screenshot:

    Screenshot of Trados Studio attribute settings showing 'href' and 'target' attributes set to 'False' for translation.

    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

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 7:46 AM (GMT 0) on 29 Feb 2024]
  • THANK YOU!

    I had to kill the Trados process via Task manager though when I tried to close the app before checking it all one more time (I had an error message after I deleted the test file from the project directories to start clean while it was still open in an editor window).

    Anyway, after the restart the test file works fine, without any further changes. Weird.

    BUT WHAT TO DO WITH EXISTING FILES?

    Do I now have to add all files which were already part of the project again to apply the new rule? (At least I don't see any effect of the rules. Maybe I'm still missing something.)

    *

    Preview of TEST file is fine:

    Screenshot of Trados Studio preview window showing HTML file with text 'Stress Test Your Idea for Desirability' and highlighted links.

    Adding the TEST file works as well:

    Screenshot of Trados Studio translation editor with segmented text for translation, including source and target language columns.

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 7:46 AM (GMT 0) on 29 Feb 2024]
  •  

    All changes applied to any project, settings and so on behave like a cup of tea: multifarious.filkin.com/.../

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

    emoji
  • Jerzy Czopik

    Feels still a bit cryptic to me but I figured that I had to remove a file and add it again to get the new rule to be applied during segmentation – which makes sense of course although I had hoped otherwise because it makes the workflow much more complicated: Sometimes you just don't know at the beginning to deal with all details of a project.

    emoji
  •   

    Now that the parsing does work and I figured that I had to add files again if I want the new rule to be applied during parsing, I wonder:

    - Is it possible to re-run the parsing without adding a file again? I tried but couldn't find any batch action or any other command so far. Maybe I'm missing something.

    - Is it possible to show the extracted content of the attributes (data-primary, and so on) in a different format? So far I only see a formatting option for the enclosed content between the tag pair (<a> ... </a>) but none for the extracted strings.

    emoji
  •  

    I agree. However, if you think about my tea comparison, the way it works is quite logical.

    When you have to deal with unknown files, the preview function in the file type configuration is very helpful.

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

    emoji
1 2