How to translate the alternative text of images in Trados

Hello!

A client of mine exported a CSV file (separated by ; and with " as string delimiter) from his website for translation, and I really can't create a rule to translate the text in the img alt tag.

Ex.

4615;"Let's talk about water [infographic]";"[DO NOT TRANSLATE]";"[DO NOT TRANSLATE]";"<p>It sounds pretty obvious that you can't live without a lot of water.<br />But how much water do you need, actually?</p><p><img alt=""This is a huge amount of water"" src=""/site/assets/files/4615/i_need_water_2021_1.jpg"" width=""1600"" /><img alt=""Another picture of water"" src=""/site/assets/files/4615/ocean_2021_2.jpg"" width=""1600"" /><a href="""></a></p>";"[DO">www.lotofwater.com/.../p>";"[DO NOT TRANSLATE]";"[DO NOT TRANSLATE]";"[DO NOT TRANSLATE]";"[DO NOT TRANSLATE]"

As I couldn't translate the CSV file using the CSV filetype (there is more than one column to translate) nor the TXT filetype (for segmentation issues), I chose to save it as XLSX.

I took off the standard tag definition rules and added a rule for every single tag, as the standard rule covers the alt img tag.

Now, I want to translate the alternative text (in orange) creating a tag pair with the rest of the tag, but I can't find a rule for that.

I tried with this:

[\<]+[^\"]+\"

+

[\""]+[^\>]+\>

But the second part begins from the first couple of "".

What is the right way to create this rule?

Parents
  • You've got to love these localization friendly clients ;-)

    Your rule is far too generic.  For example, this is what you capture with your opening expression:

    This with your closing:

    You are going to end up with a lot of overlap and probably error messages as well.  To create a rule specifically for this part you could try something like this:

    Opening:

    <img[^"]+""

    Closing:

    (?<=<img[^"]+"".*)""

    A bit messy perhaps but it should do this:

    Opening:

    Closing:

    The closing search on its own picks up more than needed but as this is intended to be used with the opening tag I think it'll be ok.  You could probably refine it if you really wanted to but hopefully this will give you the idea what what it means to add a rule for every single type of tag.

    So I did quick test..

    Also make sure you set the segmentation for the rule to exclude, and it looks like this:

    So does the trick.  Now I'd just need the other rules... which I'm sure you have sorted.

    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

  • In fact I added a few more rules and changed the one I gave you:

    Screenshot of Trados Studio showing tag definition rules with various expressions and their corresponding tag types and translation settings.

    Looks a lot cleaner apart from the last bit which I deliberately left in:

    Preview of an Excel file in Trados Studio with text segments in two columns, original and translated, highlighting a URL that should not be translated.

    I left it in because this simply looks wrong and if it was me I'd go back to my client and check:

     [DO">www.lotofwater.com/.../p>

    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:39 AM (GMT 0) on 5 Mar 2024]
  • I totally get your first comment about how generic my rule was, I must admit that I'm just a newbie in this.

    However, I can't be more specific, as the file has a lot of lines with different <img alt=""[...]> tags.

    Using the rules you gave me in first comment, this is my preview:

    Screenshot of Trados Studio showing HTML code with visible tags such as paragraph, break, anchor, and image. The image tags contain incomplete src attributes and are highlighted in purple.

    And these are the rules I had

    Screenshot of Trados Studio displaying regex rules for HTML tags including paragraph, break, anchor, strong, and image. The image tag rule is highlighted.

    So, the problem stays: the opening is ok, but the closing leaves parts that I must not translate.

    Here's my idea for the closing:

    The rule starts from the opening, ignores the opening rule and the text to translate, and states: "from "" to > everything must be part of the tag"

    By the way, can you suggest me a good beginner manual about regex rules? :D

    Edit:

    About this:

    I left it in because this simply looks wrong and if it was me I'd go back to my client and check:

     [DO">www.lotofwater.com/.../p>

    Something went wrong during copy, I updated it in my test file.

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 4:39 AM (GMT 0) on 5 Mar 2024]
  • Using the rules you gave me in first comment, this is my preview:

    So it looks as though that rule I gave you works as it does exactly what was expected... apart from the additional bits which I think is due to a bug in Studio.  However, if you were to use the more complete rules I created in the second comment, and make sure the exclude is set, then it is much cleaner.

    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