views:

535

answers:

6

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.

+1  A: 

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.

IgKh
yes, that's what I was planning - I will release the code once it's up and working. Again, the ides is not to produce usable translations, but rather to produce good-looking translation data, for demonstration purposes only.
Thomi
A: 

Yes, it's possible; and actually not hard at all!

I've written a C++ api before that used the Google Translate Ajax Javascript API (this is the only existing Google Translate API) using libCURL to make rough translations for an unfinished game.

Since Qt linguist uses XML files according to the person above, it should be quite easy to translate and write them to a valid XML file!

Chaoz
+2  A: 

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

Paul Dixon
A: 

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
Phil Hannent
A: 

have a look at http://omegat.org

it integrates google translate, automatic dictionary look up, translation memory and more.

OmegaT reads and writes many formats including .po and Open Office (a XML flavour). Not sure about general XML, but there are tools like xml2po .

Thomas Zahreddin
A: 

I am translate the .ts (Qt linguist) files with TM-database software. It native support the .ts files, Translation memory and google translate. TM-database is free and available at http://yehongmei.narod.ru/