Qt Auto Translator

What is Qt Auto Translator

Logo

Qt Auto Translator is an semi-automated tool to translate a TS file of a Qt Project.

It will extract the entries from a .ts file and generate a simple text file, which you can upload to an online translator (i.e. Google Translate). You can save its output and feed it back to Qt Auto Translator, and it will automatically fill the ts with the corresponding translations.

You also can provide already translated entries which will override the online translations. This is important when you have a set of phrases that online translation tools cannot translate.

Source Code

https://github.com/gnomezgrave/qt-auto-translator

How to use it?

Qt Auto Translator is an semi-automated tool to translate a TS file of a Qt Project.

  • In order to use this tool, your Qt Application should be localized.
    • You must use tr() to enclose static texts.
    • i.e. this->setTitle(tr("About"));
  • Then use the lupdate command to update the ts file.
  • After opening Qt Auto Translator, locate the .ts file that you want to translate.
  • Then click on “Generate Online Translatable File
    • It will give you a simple text file with all the entries inside the .ts file.
    • Save the file. (i.e. Online.txt)
  • Translate the file using an Online Translation Tool.
    • Go to the online translator (i.e. Google Translate)
    • There is an option to upload a .txt file. Upload the .txt which is generated from the above step.
    • Save the output in another .txt file. (i.e. Translated.txt)
  • Apply the translations
    • Open the Qt Auto Translator and you can see there are two text fields to locate the generated.txt file and the translated.txt file. Locate them using the corresponding browse buttons.
    • If you already have a set of pre-translated phrases (which are already in the .ts file), locate that file using the “Manually Translated File” option. This file must contain value pairs as phrases & translated text.
      The “Entry Separator String” in the Settings section will be used to extract these entries. Hence, make sure that the entries in your file is separated using that string.
  • Generate a Manual File for further usage
  • If you need to translate any phrases manually, generate a manual file and translate them. Then you can use it to update the .ts file.

For further information, contact us on http://hexmatter.com

07 comments on “Qt Auto Translator

  • Guillaume , Direct link to comment

    Hi, this looks like what i am looking for. Unfortunately, I can’t download Qt Auto Translator, your link is not working?

  • Eric de Quartel , Direct link to comment

    There is no qt project file in GIThub. I can download it but not compile the source. Very interested in your work.
    Thanks

    • Praneeth Peiris , Direct link to comment

      Hi,
      Thanks for the comment. This project was created as a Visual Studio project, and that’s why it doesn’t have a .pro file.
      I will try to create a new Qt project file and push it.

  • mrfeigao , Direct link to comment

    Good idea and good start,. There are a couple of bugs, and hope this can be fixed soon.
    1. The translated text is loaded, but the textstream for it needs to be set to uft-8. Otherwise cannot process like Asian languages
    2. The code asssume each translatable item is a single line when read back the translatetion, which is wrong assumption. I am not very sure how google translation would break lines, but it does. so the code to update translation does need to take care of this.

    • Praneeth Peiris , Direct link to comment

      Thanks a lot. I will take a look at these bugs. In case you have time and expertise, please feel free to make a pull request if you like.

Leave a Reply