Better smart quotation marks while typing (like in Word) for files and languages with missing settings

Hi,

I’ve been fiddling around quite some time now in order to get it working without triggering errors in Trados Studio (beginning and end of line and first or last line, aso.) but now this gives custom quotation marks just like in Word. They are placed according to their relative position to the text (opening vs. closing) and not depending on if you already typed a quotation mark or not (existing script from Jesus Prieto (if I remember correctly)). It even works if you place the caret anywhere in your segment and type a ".

Notes:

I set it with code to only work in Trados Studio, if you want to use it anywhere just remove the first and the last line of the above code.

It is triggered if " (straight quotation marks (Shift +2 on German keyboard)) is typed, if you want another character as trigger, just replace the " in line ":: with the character you want.

This one uses German curly quotation marks but you can just replace the quotation marks with the ones you would like to by replacing the characters before the seceral ;open or ;close parts respectively. It could also be used for Spanish exclamation and question marks as they follow the same behaviour.

You might see your mouse cursor jump around, that’s intended, so no need to worry about it.

Best regards,

Pascal



Edit: added code to keep mouse at initial position and to preserve clipboard text
[edited by: Pascal Zotto at 4:47 PM (GMT 0) on 21 Nov 2022]
emoji
  • Thanks for sharing your work  !

    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
  • Good! I like the idea of checking the previous character!

    I only wanted to have a quick test and I ended up trying new things. Grinning

    I'd add checking also for opening brackets ((): if (RegexMatch(mycheck,"[^\s\(]"))

    Also if I remove lines 8 and 9, I get an opening quotation when the segment is empty (I guess that was the purpose).

    Does the script following script work for you (I removed a few lines)?

    emoji
  • Hi ,

    the lines you removed are unfortunately necessary even if they seem superfluous as else we get are erroneous placements especially at the end of the segments. So, no, it does not correctly work in all cases without these lines.

    I had to add those 2 lines in order to avoid Trados error messages especially within the very first segment.

    Yes, you’re right, I completely forgot about that usecase. But then we need to add the other brackets too. ;)

    Best regards,

    Pascal

    emoji