Trados Embedded content when importing files

Hi Team,

I would like to ask for help in preprocessing certain content that my clients require when importing files into Trados.

Screenshot of Trados Studio showing multiple segments with sentences starting with 'test segment' highlighted in yellow.

(I apologize for not being able to provide the actual translation content due to NDA restrictions)

The content I need to process is as follows: all sentences starting with "Test" should be converted to "Tag", as these are DNT contents.

I have attempted to use regular expressions in Trados' Embedded content.

Regex : test\s*[\s\S]+$

Trados Studio dialog box for adding or editing embedded content rule with a regular expression field filled with 'tests*sS+$'.

However, it seems that they are not converted to tags, and there are still some sentences that are not being recognized correctly.

Trados Studio interface displaying a segment with a yellow highlight indicating an unconverted 'test segment' and a file path at the bottom.

Could you please help me for this issue?

Q1 : Convert to tags
Q2 : Un-converted segment's6507.SDL Trados test - Word-0.docx



Generated Image Alt-Text
[edited by: Trados AI at 11:31 AM (GMT 0) on 29 Feb 2024]
emoji
Parents Reply Children
  •  

    Does the highlighting you showed really represent exactly what you see?  For example, is only the first part of the paragraph you should not translate highlighted in yellow, or did you just create something you thought might help you get an answer?  So is this correct and meaning don't translate any of this text that has a highlighted bit at the start:

    Screenshot showing a paragraph in a Word document with the first part highlighted in yellow, indicating text not to be translated in Trados Studio.

    Or does it just mean don't translate the highlighted part?

    If you really meant don't translate the whole paragraph when it starts with this highlighted text then you could do it by running a macro in Word to add the hidden attribute to the entire paragraph when it starts with this formatting.  For example:

    Sub HideHighlightedParagraphs()
        Dim oPara As Paragraph
    
        ' Loop through each paragraph
        For Each oPara In ActiveDocument.Paragraphs
            ' Check if the first character is highlighted
            If oPara.Range.Characters(1).HighlightColorIndex <> wdNoHighlight Then
                ' Hide the paragraph
                oPara.Range.Font.Hidden = True
            End If
        Next
    End Sub
    

    Trados Studio will exclude this formatted text from translation by default.

    Then when you're done reverse the process to remove the hidden attribute from these same paragraphs with this script:

    Sub UnhideHighlightedParagraphs()
        Dim oPara As Paragraph
    
        ' Loop through each paragraph
        For Each oPara In ActiveDocument.Paragraphs
            ' Check if the first character is highlighted
            If oPara.Range.Characters(1).HighlightColorIndex <> wdNoHighlight Then
                ' Unhide the paragraph
                oPara.Range.Font.Hidden = False
            End If
        Next
    End Sub
    

    You can insert these macros as follows:

    1. Open your Word document.
    2. Press ALT + F11 to open the VBA editor.
    3. Click Insert from the menu, then click Module to create a new module.
    4. Copy and paste the code into the module
    5. Close the VBA editor.
    6. Press ALT + F8, select HideHighlightedParagraphs or UnhideHighlightedParagraphs from the list, and click Run as appropriate.

    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 11:31 AM (GMT 0) on 29 Feb 2024]
  • Hello Paul,

    Thank you for your help.

    In fact, the customer requested that certain words at the beginning of the content should not be translated.
    In my example, it can be understood that anything after "Test" in a sentence should not be translated.
    However, there may be various special formats following "Test", not just highlighting.

    Screenshot of Trados Studio showing four segments of text with the word 'test' highlighted in yellow at the beginning of each segment.

    emoji


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

    In my example, it can be understood that anything after "Test" in a sentence should not be translated.

    In a sentence or a paragraph?  Does this mean you don't translate this... just the highlighted text:

    Highlighted text 'test segment 38 3' in yellow within a document.

    Or this... just the sentence after and including the highlighted text:

    Highlighted phrase 'test segment 38 3' in yellow at the beginning of a sentence within a paragraph.

    Or this... the complete paragraph following the highlighted text:

    Highlighted phrase 'test segment 38 3' in yellow at the start of a paragraph followed by unhighlighted text.

    If there is some sort of clear rule it should be reasonably straightforward to handle with a Word macro.

    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 11:31 AM (GMT 0) on 29 Feb 2024]