Automation Studio Scripts - Translate TMX

The script translates TMX texts from the selected source language to the target language using the chosen translator.

How does the script work?
  1. Project languages and paths to TMX files are read
  2. The source language texts of the selected TMX file are read
  3. The source texts are translated to the target language via selected translator
  4. Translated texts are written to the TMX file
User settings

User settings are stored in folder AppData\Roaming\BR\Scripts\TranslateTmx

Advantages
  • Easy translation of all texts based on online translators
  • Saves developer time
  • Selection of multiple translators
  • Supports paid versions of DeepL and Yandex (but also free version of DeepL)
Limitations
  • Translating may take a long time depending on server load, internet connection speed and amount of translated data. However, while the texts are being translated, the developer can continue to work on the project.
  • Languages defined by code-country ID are not supported. However, the script will offer you just code ID if code-country ID is selected (i.e. en-GB → en).
Requirements
  • Python (info)
  • Python library PyQt5 (info)
  • Python library deep-translator v1.8.1 or higher (info)
  • Internet connection
  • Some translators require an API key that provides access to the translation service (DeepL, Yandex). The API key is obtained by registering on the translator’s website, the link to the websites is in the script.
Implementation to your project
  1. Add the script to the Logical View of your project
  2. Double-click on it
  3. Fill in the form
Video tutorial / demonstration

Video

Version info

Version 1.1.0

  • Non-translation of snippets

Version 1.0.2

  • Confirmation of Terms of Use added

Version 1.0.1

  • Adjustments for the new version of deep-translator library

Version 1.0.0

  • Script creation
  • Basic functions implemented

Download
TranslateTmx_v1.1.0.zip (9.6 KB)

GitHub repo
Translate TMX

16 Likes

Thanks @michal.vavrik! :slight_smile: This has potential for wide usage among BR users. Feel free to test it and provide feedback to Michal :slight_smile:

Hi @michal.vavrik! :slight_smile:

Wow! A huge thank you for this tool – it makes providing a multilingual user interface so much easier without having to resort to endless copy-pasting or messing around with tools like ChatGPT. Really appreciate it!

Question/Feedback:
Sometimes, texts include English terms, like error codes or error names from other manufacturers, that shouldn’t be translated. It would be awesome if there were a way – similar to ValueSnippets like {&myVar} – to exclude specific parts of the text from translation.

For example:
MeinText “PowerSupplyError (Not translated)”

Anything embedded in certain special characters could then be skipped. What do you think about that?

In principle, it could work with {}, but it’s a bit clunky when those brackets show up in the final text.

Looking forward to hearing your thoughts, and thanks again for this awesome contribution – excited to see how this tool might evolve in the future!

Hey Michal, Its a great tool. I tried using it in my project. But I keep getting this error.

I changed the network to my personal mobile network. But still got the same issue. Do you think there could be any other settings i need to change as well?

Hi Abhishek, it works for me in corporate and also external network. This error is directly from python module deep-translator, when it tries to translate texts it gets “requests.exceptions.ConnectionError”. Maybe some issue with firewall/antivirus. What version of the deep-translator module do you have installed (open command line and enter “pip list”)? For further information please edit the python code on line 621 like this:


And run the script from command line. It should print the exception text to the command line, we can then investigate what is the problem.

1 Like

Hi Andreas, thanks for your feedback. That would be a good feature, I will add this as optional parameter once I will have time to extend this script. :slight_smile:

1 Like

Hey Michal, I tried by modifying the the script as you suggested. Below is the Exception that I get.

HTTPSConnectionPool(host=‘translate.google.com’, port=443): Max retries exceeded with url: /m?tl=de&sl=en&q=Parameter+Page (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1028)’)))

Also the version of deep-translator is 1.11.4

Hi Abhishek, it’s a certificate verification problem. Try turning off certificate verification, it’s the “verify” parameter of the “get” function of the requests module, but you’ll have to write it directly into the deep-translator library in the translator you’re using. I’m attaching a video with instructions on how to do it for Google Translator.
VerificationOff.zip (2.9 MB)

1 Like