"notranslate" in xlf files

Hi,

I hope I'm here at the right place for my question.

I work in Trados Studio, we receive xlf files (exported from K4) from our client. The client there marks some single words as "notranslate", e.g.:

<g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-1-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0"><g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-1-5">XXXXX</g></g><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-1-6" tlf:char-style="80;228;9;11;-1;0;0;0"> Operating Instructions</g></source><target state="needs-translation"></target></trans-unit></group>

The XXXXX is the text that should not be translated.

How do I tell Studio to tag this text as text, which should not be translated, I suppose it should be tagged accordingly?

Thanks,

Johannes

emoji
Parents Reply Children
  •  

    In that case you're in luck as you can use the Multilingual XML filetype and handle both source and target which means if you do happen to get some with target in there it'll be covered.

    The process of setting up this filetype is explained here:  Multilingual XML FileType 

    The settings that seem to work for me in the test I made up (since you didn't provide one) are these:

    Language Root:
    /xliff/file/body/group/trans-unit[not(.//source//g[@ctype='x-tlf-notranslate'])]

    Languages:
    source
    target

    Looks like this:

    The image shows a translation software's 'Language Mapping' settings, with English set as the source language and German as the target. An XPath query is present, and the 'Treat as monolingual' option is unchecked.

    My source file... since there is no guarantee these settings will work for you, was this:

    <?xml version="1.0" encoding="UTF-8"?>
    <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:tlf="urn:oasis:names:tc:xliff:document:1.2">
      <file source-language="en" datatype="plaintext" original="file.ext">
        <body>
          <group id="G1">
            <trans-unit id="TU1">
              <source><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-1-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                <g ctype="x-tlf-translate" equiv-text="translate" id="IM-361-1-5">K4</g>
              </g><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-1-6" tlf:char-style="80;228;9;11;-1;0;0;0"> 
                crafted a file with a quirk,</g></source>
              <target state="needs-translation"></target>
            </trans-unit>
            <trans-unit id="TU2">
              <source>
                <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-9-5">DON'T TRANSLATE THIS</g></source>
              <target state="needs-translation"></target>
            </trans-unit>
            <trans-unit id="TU3">
              <source><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-2-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                <g ctype="x-tlf-translate" equiv-text="translate" id="IM-361-2-5">XLIF</g>
              </g><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-2-6" tlf:char-style="80;228;9;11;-1;0;0;0"> 
                extensions it did surely pick,</g></source>
              <target state="needs-translation"></target>
            </trans-unit>
            <trans-unit id="TU4">
              <source><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-3-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                <g ctype="x-tlf-translate" equiv-text="translate" id="IM-361-3-5">Custom tags</g>
              </g><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-3-6" tlf:char-style="80;228;9;11;-1;0;0;0"> 
                with a nonsensical flick,</g></source>
              <target state="needs-translation"></target>
            </trans-unit>
            <trans-unit id="TU5">
              <source>
                <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-9-7">DON'T TRANSLATE THIS EITHER</g></source>
              <target state="needs-translation"></target>
            </trans-unit>
            <trans-unit id="TU6">
              <source><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-4-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                <g ctype="x-tlf-translate" equiv-text="translate" id="IM-361-4-5">A system</g>
              </g><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-4-6" tlf:char-style="80;228;9;11;-1;0;0;0"> 
                where translations stick.</g></source>
              <target state="needs-translation"></target>
            </trans-unit>
            <trans-unit id="TU7">
              <source><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-5-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                <g ctype="x-tlf-translate" equiv-text="translate" id="IM-361-5-5">Laugh</g>
              </g><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-5-6" tlf:char-style="80;228;9;11;-1;0;0;0"> 
                at the code, so rich and thick,</g></source>
              <target state="needs-translation"></target>
            </trans-unit>
          </group>
        </body>
      </file>
    </xliff>
    

    Hopefully you'll have enough information here to manage this yourself.  But please read the wiki as there are other settings you may require to make this suitable for your needs.  If you only add these expressions and then come back and say it doesn't work it won't be helpful!  It does for me:

    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
  • Hi Paul,

    thanks a lot for all your efforts, this is already very helpful.

    Sorry, I was not aware that I should have provided you a file for testing purposes.

    I followed your steps and could reproduce everything, you did a pretty good guessing, as your path is also working for my file.

    In Studio, I can create a project and the segments with the notranslate flag are not shown.

    This therefore works fine now when a segment completely needs to be marked as notranslatable.

    In the example I have sent, actually only one term (the Xs) should be marked as notranslate, the rest of the segment should be present and translatable. So only the part of the segment within the notranslate brackets should be tagged as notranslate, but the segment itself should be displayed.

    Do you also have an idea how that could be implemented?

    I have prepared a Studio project with a file, how can I send that to you?

    Best regards,

    Johannes

    emoji
  •  

    A bit trickier because there is no markup in the target element, so to do this I first opened the XLIFF with the out of the box XLIFF filetype, copied source to target to get the markup in there (otherwise it will exclude the notranslate fromthe target completely) and used that to translate with.  I then created a new settings file and used these settings:

    Language Root:
    /xliff/file/body/group/trans-unit

    Languages:
    source/g[not(.//g[@ctype="x-tlf-notranslate"])]
    target/g[not(.//g[@ctype="x-tlf-notranslate"])]

    This seems to work nicely and if I use this test file:

    <?xml version="1.0" encoding="UTF-8"?>
    <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:tlf="urn:oasis:names:tc:xliff:document:1.2">
      <file source-language="en" datatype="plaintext" original="file.ext">
        <body>
          <group id="G1">
            <trans-unit id="TU1">
              <source><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-1-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-1-5">Embrace the day with open arms,</g>
              </g><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-1-6" tlf:char-style="80;228;9;11;-1;0;0;0"> 
                Night falls, and so begins the charms,</g></source>
              <target state="needs-translation"></target>
            </trans-unit>
            <trans-unit id="TU2">
              <source><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-2-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-2-5">Full of life, the world in view,</g>
              </g><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-2-6" tlf:char-style="80;228;9;11;-1;0;0;0"> 
                Stars above, a silent few,</g></source>
              <target state="needs-translation"></target>
            </trans-unit>
            <trans-unit id="TU3">
              <source><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-3-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-3-5">Joyous light in every beam,</g>
              </g><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-3-6" tlf:char-style="80;228;9;11;-1;0;0;0"> 
                Darkness brings a different dream,</g></source>
              <target state="needs-translation"></target>
            </trans-unit>
            <trans-unit id="TU4">
              <source><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-4-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-4-5">With every rise, hope ascends,</g>
              </g><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-4-6" tlf:char-style="80;228;9;11;-1;0;0;0"> 
                Twilight whispers, the day ends,</g></source>
              <target state="needs-translation"></target>
            </trans-unit>
            <trans-unit id="TU5">
              <source><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-5-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-5-5">Sun's warmth on faces gleam,</g>
              </g><g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-5-6" tlf:char-style="80;228;9;11;-1;0;0;0"> 
                Moon's cold touch reigns supreme.</g></source>
              <target state="needs-translation"></target>
            </trans-unit>
          </group>
        </body>
      </file>
    </xliff>
    

    It successfully gets me this (machine translated after opening obviously):

    The image is a screenshot of a translation software interface displaying two columns of text: the original English text on the left and its German translation on the right. Each line of poetry is paired with its German equivalent, and each segment is marked with a green 'P+' sign, indicating a status, likely 'proofed' or 'completed'. The interface header shows the file type as 'Multilingual XML FileType v 2.0.0.0'.

    as opposed to this:

    The image is a screenshot of a text editor within translation software, showing English text awaiting translation. Alternate lines are marked with 'notranslate', highlighted in purple, indicating they should remain untranslated. The unmarked lines are part of a poem about nightfall and nature, while the marked lines are instructional or non-poetic. The right side of the interface is blank, designated for the translated text, and each line has a 'TU+' marker, perhaps signifying 'Translation Unit'.

    If I save the target file I get this:

    <?xml version="1.0" encoding="UTF-8"?>
    <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:tlf="urn:oasis:names:tc:xliff:document:1.2">
      <file source-language="en" datatype="plaintext" original="file.ext">
        <body>
          <group id="G1">
            <trans-unit id="TU1">
              <source>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-1-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                  <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-1-5">Embrace the day with open arms,</g>
                </g>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-1-6" tlf:char-style="80;228;9;11;-1;0;0;0"> 
                Night falls, and so begins the charms,</g>
              </source>
              <target state="new">
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-1-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                  <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-1-5">Embrace the day with open arms,</g>
                </g>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-1-6" tlf:char-style="80;228;9;11;-1;0;0;0">Die Nacht bricht an, und damit beginnt der Zauber,</g>
              </target>
            </trans-unit>
            <trans-unit id="TU2">
              <source>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-2-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                  <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-2-5">Full of life, the world in view,</g>
                </g>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-2-6" tlf:char-style="80;228;9;11;-1;0;0;0"> 
                Stars above, a silent few,</g>
              </source>
              <target state="new">
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-2-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                  <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-2-5">Full of life, the world in view,</g>
                </g>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-2-6" tlf:char-style="80;228;9;11;-1;0;0;0">Sterne über uns, ein paar stille,</g>
              </target>
            </trans-unit>
            <trans-unit id="TU3">
              <source>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-3-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                  <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-3-5">Joyous light in every beam,</g>
                </g>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-3-6" tlf:char-style="80;228;9;11;-1;0;0;0"> 
                Darkness brings a different dream,</g>
              </source>
              <target state="new">
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-3-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                  <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-3-5">Joyous light in every beam,</g>
                </g>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-3-6" tlf:char-style="80;228;9;11;-1;0;0;0">Die Dunkelheit bringt einen anderen Traum,</g>
              </target>
            </trans-unit>
            <trans-unit id="TU4">
              <source>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-4-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                  <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-4-5">With every rise, hope ascends,</g>
                </g>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-4-6" tlf:char-style="80;228;9;11;-1;0;0;0"> 
                Twilight whispers, the day ends,</g>
              </source>
              <target state="new">
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-4-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                  <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-4-5">With every rise, hope ascends,</g>
                </g>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-4-6" tlf:char-style="80;228;9;11;-1;0;0;0">Die Dämmerung flüstert, der Tag endet,</g>
              </target>
            </trans-unit>
            <trans-unit id="TU5">
              <source>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-5-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                  <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-5-5">Sun's warmth on faces gleam,</g>
                </g>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-5-6" tlf:char-style="80;228;9;11;-1;0;0;0"> 
                Moon's cold touch reigns supreme.</g>
              </source>
              <target state="new">
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-5-4" tlf:char-style="80;228;9;11,213;-1,100;0;0;0">
                  <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-361-5-5">Sun's warmth on faces gleam,</g>
                </g>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-361-5-6" tlf:char-style="80;228;9;11;-1;0;0;0">Die kalte Hand des Mondes hat die Oberhand.</g>
              </target>
            </trans-unit>
          </group>
        </body>
      </file>
    </xliff>

    So the notranslate parts are not translated and the rest is.

    However... the target elements now contain an exact copy of the source in terms of the markup and this may not be suitable for your client.  So I think you need to try it, and then have a discussion with your customer to see if this is what they really needed.  For all I know they may only want the translatable part in the target file in which case you can use these settings on the original XLIFF (no need to copy source to target):

    Language Root:
    /xliff/file/body/group/trans-unit

    Languages:
    source/g[not(.//g[@ctype="x-tlf-notranslate"])]
    target

    And now you'll get a target file like this:

    The image displays a snippet of an XML code from a translation software, showing two translation units. The first unit contains the English source text "Night falls, and so begins the charms," with its German translation "Die Nacht bricht an, und damit beginnt der Zauber." The second unit has the English text "Stars above, a silent few," and its German counterpart "Sterne über uns, ein paar stille." The code includes markup for translation states and formatting, with tags indicating text style and translation attributes.

    Note that the target only contains the translated part in the target element and omits all the rest of the markup.

    I hope you can see the problem and explain this properly to your customer?  Perhaps they can do this in a smarter way and separate the notranslate parts into separate translation units or something like that.  Certainly this isn't a very friendly localizable format when customised in this way which seems to defeat the objective of XLIFF in the first place.

    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
  • Hi Paul,

    Sorry for my late reply, but I was at the tekom fair last week. Thanks for the thinking the next step.

    I am not sure where to place the "Languages" settings you mentioned above. Is it correct that way?

    Trados Studio project settings window showing 'Datentyp-Einstellungen fur das Projekt' with 'Multilingual XML' and 'Language Mapping' selected. English and Chinese languages are listed with specific file locations and an error icon next to the Chinese language.

    I do not find any other option where to place that.

    But when doing that, Studio does not recognize the xlf file with this data type any longer. :-(

    What am I doing wrong? I suppose the settings above are correc, then the problem must be with the xlf file I have created.

    I used the source xlf file, openend it with the regular xlf file type in Studio, copied source to target and saved that file again as target xlf. That's then the xlf to open with the new Multilingual XML file type. Right?

    Many thanks,

    Johannes

    emoji


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

    Did you test with the source file I shared?  That one is a known quantity.  If mine works and yours does not then we'd need to see your file as it may be different.

    I have prepared a Studio project with a file, how can I send that to you?

    The project is of no interest for me... only the source file.  You can zip it and attach it to your reply.

    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
  • This file worked with the first solution you gave me. But not with the second. Thanks.

    emoji
  •  

    The problem you have here is that with this file you actually have nested g elements:

              <source>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-581-8-1"
                tlf:char-style="834;226;10;11;-1;0;0;0">Remove the</g>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-581-8-2"
                tlf:char-style="834;226;10;11,213;-1,100;0;0;0">
                  <g ctype="x-tlf-notranslate" equiv-text="notranslate"
                  id="IM-581-8-3">Safe-Cone</g>
                </g>
                <g ctype="x-tlf-char-style" equiv-text="style" id="IM-581-8-4"
                tlf:char-style="834;226;10;11;-1;0;0;0">Filter.</g>
              </source>

    This isn't a particularly smart way to use XLIFF as there is really no sensible way to control this.  It would be far more sensible to ensure that each <g> element is its own trans-unit, and to do this your client would need to restructure the <group> by creating individual trans-unit elements for each <g> element within the <source>. This makes each segment clearly identifiable and independently translatable, which is especially useful in localization workflows.

    For example:

    <group extype="story" id="ST-581" resname="Decommissioning" translate="yes">
      <trans-unit id="TU-581-7" translate="yes">
        <source>Switch off the device.</source>
        <target state="needs-translation"></target>
      </trans-unit>
      <trans-unit id="TU-581-8-1" translate="yes">
        <source>
          <g ctype="x-tlf-char-style" equiv-text="style" id="IM-581-8-1" tlf:char-style="834;226;10;11;-1;0;0;0">Remove the</g>
        </source>
        <target state="needs-translation"></target>
      </trans-unit>
      <trans-unit id="TU-581-8-2" translate="yes">
        <source>
          <g ctype="x-tlf-char-style" equiv-text="style" id="IM-581-8-2" tlf:char-style="834;226;10;11,213;-1,100;0;0;0">
            <g ctype="x-tlf-notranslate" equiv-text="notranslate" id="IM-581-8-3">Safe-Cone</g>
          </g>
        </source>
        <target state="needs-translation"></target>
      </trans-unit>
      <trans-unit id="TU-581-8-3" translate="yes">
        <source>
          <g ctype="x-tlf-char-style" equiv-text="style" id="IM-581-8-4" tlf:char-style="834;226;10;11;-1;0;0;0">Filter.</g>
        </source>
        <target state="needs-translation"></target>
      </trans-unit>
    </group>

    In this structure:

    • Each <g> element inside the original <source> of trans-unit TU-581-8 has been moved to its own trans-unit.
    • Each trans-unit is assigned a unique ID (TU-581-8-1, TU-581-8-2, TU-581-8-3, etc.) to maintain the order and uniqueness.
    • The <source> and <target> elements are retained within each trans-unit for consistency with XLIFF standards.

    This approach facilitates more granular control over the translation process for each segment and ensures that the structure is clear and manageable for translators.  In fact it will also benefit your client in the long run as the whole localization process will be more economical and less likely to cause problems when they get the translated files back full of mistakes.

    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
  • Hi Paul,

    thanks a lot for taking this deep look into this issue. Unfortunately this does not solve the issue the way I hoped for.

    We have one sentence:

    Remove the Safe-Cone Filter.

    The term "Safe-Cone" is marked as untranslatable.

    This also should be one segment in the translation.

    When I understand it correct, then in your solution the client should handle this one sentence with three segments, right?

    Remove the

    Save-Cone

    Filer.

    This is not practicable, as in various languages the word order is changing, so I would need the whole sentence in one segment, but with the non-translatable term tagged in some way.

    Thanks,

    Johannes

    emoji
  •  

    Unfortunately this does not solve the issue the way I hoped for.

    ok - then I think your best bet with this file is to do this:

    1. copy source to target using the out of the box XLFF filetype.
    2. save the target so you have an XLIFF with the source already in the target (although your client could probably make this easier for you and just provide an XLIFF with the target already populated with a copy of the source)
    3. create a custom XML filetype that only extracts the target content (that is actually source text) and translate that

    I think it should be fairly trivial to create the filetype for this, especially with all the examples you now have for the XPath expressions.

    The downside to this approach, and it would have been the same in the Multilingual XML filetype, is that you won't be able to affect the XLIFF statuses which the XLIFF filetype can manage.  Other than that I think this is the way to go... monolingual custom XML filetype translating the text stored in the target elements.

    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