Excluding metatag content from XLF file

Hello

I'm looking for a way to exclude some content that does not need translation from a XLF file exported from Drupal

For ex

<trans-unit id="204706][metatag][2][tag" resname="204706][metatag][2][tag">
<source xml:lang="en"><![CDATA[meta]]></source>
<target xml:lang="zh-hans"><![CDATA[meta]]></target>
</trans-unit>
<trans-unit id="204706][metatag][3][tag" resname="204706][metatag][3][tag">
<source xml:lang="en"><![CDATA[meta]]></source>
<target xml:lang="zh-hans"><![CDATA[meta]]></target>
</trans-unit>
<trans-unit id="204706][metatag][4][tag" resname="204706][metatag][4][tag">
<source xml:lang="en"><![CDATA[link]]></source>
<target xml:lang="zh-hans"><![CDATA[link]]></target>
</trans-unit>
<trans-unit id="204706][metatag][5][tag" resname="204706][metatag][5][tag">
<source xml:lang="en"><![CDATA[meta]]></source>
<target xml:lang="zh-hans"><![CDATA[meta]]></target>
</trans-unit>
<trans-unit id="204706][metatag][6][tag" resname="204706][metatag][6][tag">
<source xml:lang="en"><![CDATA[meta]]></source>
<target xml:lang="zh-hans"><![CDATA[meta]]></target>

I have set the parser for the files as below but am failing to find a way to remove the above mentioned content

Trados Studio parser settings for XLIFF files showing rules for translatable and non-translatable content.*

thanks in advance for the help

yannick



Generated Image Alt-Text
[edited by: Trados AI at 12:04 PM (GMT 0) on 29 Feb 2024]
emoji
Parents Reply
  •   

    had tried your suggestions but now realize I forgot to move it up above my other rules for it to work. 

    You should delete your other rules completely... I don't believe they are necessary and may introduce things you don't want.

    But it's brought back other content I don't want to display in Trados like //note (for ex <note>Card Stack</note> seg21).

    Not for me... segment #21 is taking "Card Stack" from the target element as required:

    Screenshot showing the target element in the XLF with "Card Stack" written in it.

    I also want to exclude center, image and bundle_default; Overview Text, Shield image; etc

    Isn't this text written into the source and target element itself as translatable text? For example:

    <target xml:lang="zh-hans"><![CDATA[center]]></target>
    
    <target xml:lang="zh-hans"><![CDATA[image]]></target>
    
    <target xml:lang="zh-hans"><![CDATA[bundle_default]]></target>

    You need a completely different approach for this... which might be easier to just do with regex using the display filter!!

    But if you really want a parser rule for it maybe something like this?

    //trans-unit[not(contains(@id, 'metatag'))]/target[not(contains(., 'center') or contains(., 'image') or contains(., 'bundle_default'))]

    I just added three... I'm sure you can add the rest.  But note this is still only two rules.  There is absolutely no need for all the other rules you have in there.  They serve no purpose at all other than to risk polluting what you really need.

    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
Children