How to make only a specific content translatable in Trados 2019 Professional?

Hello, does anyone have any idea how to make a word: "network" translatable in Trados?

<meta name="search-keywords" content="network"/>

I tried to create a condition for "meta" element, but it didn't work properly. I must have done something wrong. When I made "content" translatable, I got also all other meta data translatable in Trados which I'd rather avoid. Is there a way to make it more specific?

Parents
  • This word is within the "attribute".  Attributes are typically not translated so if you need to translate one you must specify the rule to extract the content from the content attribute.  If you only want the content attribute when it's part of the meta element then you need a rule something like this:

    //meta/@content

    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

  • Hi @Paul, thank you for your quick answer. I didn't use Regex, but I made the content of the "content" attribute within the meta element translatable in the Parser of HTML5. In this way all meta content became translatable, which wasn't my intention. Please take a look at other examples, which as a result were extracted for translation in Trados:

    <meta name="generator" content="Adobe RoboHelp 2020" />
    <meta name="Originator" content="ImportMif" />
    <meta name="OriginalFile" content="C:\(...).fm" />
    <meta name="search-keywords" content="network" />

    That's why I was wondering is there a way to make the content attribute translatable only if it's paired with the "search-keywords" within the meta element, but probably it's just my wishful thinking. Should I otherwise advise the content creators to place search keywords as a plain text, not within attributes? What would you recommend? I'm in contact with them, so I'm pretty sure they will be also willing to help.

  • I didn't use regex for that, I used XPath.  However, this won't help as it will only do exactly what you have now explained.  If you could get this file as an XML file as opposed to HTML then you could solve this using XPath and specifically extracting the content attribute only when it has the sibling name="search-keywords".

    Failing that I think the best solution is to do one of two things:

    1. move this content into a new element intended only for translatable keywords, OR
    2. move this content into an attribute intended only for translatable keywords

    If this is not possible then the other solution would be to use the Advanced Display Filter and do the following:

    1. filter on the TAGs DSI
    2. lock all the segments that don't have a translatable keyword in there

    Messy though, might be faster to simply search/replace the string content="network" with the translated content in the html file itself and then don't extract this attribute at all?.

    Not sure any of this really helps?

    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

  • So for example... take this xml file:

    <?xml version="1.0" encoding="UTF-8"?>
    <rootelement>
    <meta name="generator" content="Adobe RoboHelp 2020" />
    <meta name="Originator" content="ImportMif" />
    <meta name="OriginalFile" content="C:\(...).fm" />
    <meta name="search-keywords" content="network" />
    <meta name="generator" content="Adobe RoboHelp 2020" />
    <meta name="Originator" content="ImportMif" />
    <meta name="OriginalFile" content="C:\(...).fm" />
    <meta name="search-keywords" content="world wide web" />
    </rootelement>

    If I use this single rule:

    //meta[@name="search-keywords"]/@content

    I can get this:

    Trados Studio screenshot showing a list of meta.xml file elements with 'network' and 'world wide web' as search keywords.

    Unfortunately I'm pretty sure you cannot use this as a condition in the HTML filetype, only with XML.  I tried it but could not make it work.   may know better than me here, so adding him in case I missed something.

    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 4:36 AM (GMT 0) on 5 Mar 2024]
  • Hi @Paul, thank you for your research. It looks very promising. Can RegEx be used only for XML files, then? 

  • Can RegEx be used only for XML files, then? 

    This is not Regex.  It's XPath.  You can use XPath in html files, but it's limited compared to what's possible with XML.  I added Patrik because he knows the filetypes a lot better than I do and will know if this should even be possible with the html filetype or not.

    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

Reply Children
No Data