Howto export all texts to translate with QLinguist?
-
Hi guys,
Could anyone help about the question as said by title?
It'd better export texts in a text file or something as that...
Thanks a lot,Jing
-
Not 100% sure what you're asking, but running lupdate on your code will generate the translation file that lingust reads, which is XML. You can always parse that if you need the information in some other format.
-
I appreciate your reply.
I am trying to list all texts(within tr) in source codes, and d like to find out a way to get the list quickly.
Does Qlinguist tool offers this functionality to export these texts in an excel file for example?Thanks,
-
Did you not read mlong's reply? Did you try the lupdate tool?
-
Yes I read it, and appreciate his kind reply.
I use lupdate tool, it just update my ts file, which can of course be opened on XML format.
All I ask is just can Qlinguist(after opening the ts file) export all texts in an excel or not?
Maybe it was my question which is not clear enough,
Does anyone know about it?
Thanks, -
[quote author="jingo" date="1331897573"]All I ask is just can Qlinguist(after opening the ts file) export all texts in an excel or not?[/quote]
I don't think so. -
No, it cannot. Why would it need to export to Excel?
However, perhaps Excel can just import the .ts file? It is just XML after all... -
I see...
Thanks a lot! -
Or better: write your own converter, that reads the XML and creates an Excel file for you.
-
hello,
what do you mean with "write your own converter"? I am trying to export the source text in excel and I get an xml file. How can I just get the content to translate? Is there a way to parse XML file to isolate useless tags?
What do you think?
Linda -
Sure: a bit of C++ code to parse the .ts file will do the trick just fine. Qt has some pretty good XML parsing classes. I just did something like that to auto-replace some strings in the translations. Took an hour or two all in all.
-
hello, thanks for the reply.
I have another question. Is it possible to create a phrasebook automatically? I mean: is it possible to insert all segments in it at once? -
The best way is to use Excel's integrated XML support as described here: [https://www.nextofwindows.com/how-to-convert-excel-spreadsheet-to-json](link url).
First create an XML map by using a small TS file to let Excel know how to interpret the Qt Linguist format. Finally import the data by mapping the XML elements to the worksheet columns and then by choosing the Import... option in the cell's XML context menu.
One additional note: Remove all <!DOCTYPE TS> declarations from the TS files, otherwise Excel denies the import with "unsupported document type".