Remove segments between /* -*/ for translation

Former Member
Former Member

Hello all,

I thought I had this figured out yesterday, but now I have a new issue. I have a .strings file, where I'm using a file type 'Regular Expression Delimited Text Document'. I'm having trouble getting comments (denoted with a starting /* and ending */) to not be available for translation. Here is an example of the text:

/* No comment provided by engineer. */
"%ld %@ waiting to upload \n %ld %@ waiting to upload" = "%1$ld %2$@ waiting to upload \n %3$ld %4$@ waiting to upload";

/* No comment provided by engineer. */
"%lu hour time limit." = "%lu hour time limit.";

Can someone please help me determine which regex code to use in the tag pairs to exclude this?

Thank you in advance for help.

Best, Mindy

  • This seems to be a text file. Create a regular expressions delimited text file type. As opening pattern use ^".+?" =" and "; as a closing pattern.

    You can then define some embedded content like [%$][^\s]+

    I've checked that in Regex Buddy, however to be really certain that it works I would need to have the complete file.

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

  • Former Member
    0 Former Member in reply to Jerzy Czopik

    Hi Jerzy,

    Thank you! However, the text for translation is coming into Studio very well, it's the comments (/* No comment provided by engineer. */) that I cannot get removed. 

    I do like the suggestion about the embedded content!

    Best, Mindy

  • Trados Studio options window showing Document structure settings with instructions to enter opening pattern '.*?=' and closing pattern ';' in the text fields, then click 'Modify'.

    When you do that, it should prevent Studio from reading any other line in the document, thus also remove all the comments you want.

    BTW, if you want regex to look for *, you must escape this character entering \*, as otherwise it is treated as quantifier 0 to unlimited times for the preceding character.

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 4:34 AM (GMT 0) on 5 Mar 2024]
  • Former Member
    0 Former Member in reply to Jerzy Czopik

    Hello again,

    My sincere apologies. I misunderstood your meaning. Thank you very much. I undertsand.

    Best, Mindy

  • No need to apologize, after your second answer I just supposed you might not know the "Opening pattern" and "Closing pattern" settings.

    Creating file types is a very interesting, but demanding task. Sometimes it goes very simple, on other occasion you will spend days on that. For doing this you need a basic knowledge in regex and in xpath as well. You will find good information on that on Paul Filkins blog Multifarious, which I can highly recommend. And if you understand German, you'll find also a lot of information provided by the German BDÜ. Some regex basics can also be found in this book: https://www.bdue-fachverlag.de/detail_book/150 (in English).

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

  • Former Member
    0 Former Member in reply to Jerzy Czopik

    Yes, it can be very complex and simple at the same time! I have found many Multifarious posts on this, and actually have them bookmarked. Mr. Filkin explains things extremely well. Thank you again for your help! You have saved me two days in a row. 

    Best, Mindy

  • Hi ,

    I guess you know that there is a missing space in the opening pattern:

    ^".+?" ="

    It should be:

    ^".+?" = "

    Also a safer embedded content is: %[^\s]+

  • A comment regarding style. The .+? lazy operator can be time-consuming. When a search for a "specific next character" (such as " in this case) is required, it is better to use the [^"]+" construct. 

  • Thank you for the space, I have overseen that.

    %[^\s]+ will not catch all embedded items shown here, this is why I created what I did. However, without having the complete file to test developing anything is like a view in a crystal ball. The best option would always be to treat the embedded content more specifically, i.e. a separate expression for %xx and for $xx and so on.

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

  • Thank you for the hint, I shall remember that in the future.

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

1 2