Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt linguist & google translate

I'm looking for a way to cheat and create some very rough translations of my Qt application using Qt linguist and an already-existing translation service such as google translate.

There's a public API for google translate, so I'm hoping someone has already tried this, but I can't seem to find it. Has anyone seen anything like this before?

I'm not expecting brilliant translations - at this point it's just to show as a proof of concept.

like image 351
Thomi Avatar asked Oct 08 '09 12:10

Thomi


People also ask

What is Qt Linguist in Windows 10?

Qt provides excellent support for translating Qt C++ and Qt Quick applications into local languages. Release managers, translators, and developers can use Qt tools to accomplish their tasks. Release managers bear the overall responsibility for the release of the application.

How do you run Qt Linguist?

Run Qt Linguist from the taskbar menu, or by double clicking the desktop icon, or by entering the command linguist at the command line. Once Qt Linguist has started, choose File|Open from the menu bar and select a translation source (TS file) to load.

How does Qt translation work?

The Qt tools provide context information for each of the phrases to help the translator, and the developer is able to add additional context information to phrases when necessary. The release manager generates a set of translation files that are produced from the source files and passes these to the translator.


3 Answers

I've written an open source app to do this with gettext .po files, it wouldn't be hard to modify for Qt Linguist files. Demo and php source available at http://pepipopum.dixo.net

like image 177
Paul Dixon Avatar answered Sep 19 '22 10:09

Paul Dixon


You could use lconvert to convert the files to .po

lconvert -if ts -of po -o myFile.po myfile.ts

Then run them through Paul Dixons translator, then convert them back using lconvert again.

lconvert -if po -of ts -o myFile.ts myfile.po
like image 28
Phil Hannent Avatar answered Sep 21 '22 10:09

Phil Hannent


I haven't seen anything like this before (probably because automated translation will likely produce less than stellar results), but it shouldn't be too hard to implement.

The .ts files produced by the lupdate tool are in fact plain XML files (and even not so complicated ones - just open one in a text editor and see for your self). Therefore, you can use a variety of XML tools/libraries to edit the <translation> elements in the file. Qt even comes with one.

like image 28
IgKh Avatar answered Sep 17 '22 10:09

IgKh