PDA

View Full Version : Translating non-hardcoded string



C167
25th June 2008, 22:27
Hi,
I've started a small project which should (besides other things) be able to load a file containing strings like {L_TITLE} which should get translated.
This way, lupdate and the translation system of Qt is not able to recognize those strings.
Is it possible to use the .ts files with Qt Linguist here or do i have to write a translation class on my own?
C167

jacek
25th June 2008, 23:21
.ts file basically maps one string to another. You can create a file with string constants you want to be able to translate (wrapped with QT_TR_NOOP macro) and add it to your sources, so that lupdate can pick them up and then just make sure that you use tr() in proper place.

Another approach is to create your own .ts file with just those strings. This way you will get a separate .qm file, but that's shouldn't be a problem.

C167
26th June 2008, 13:34
Oh, thx.
at the moment, i try to find a sed line to extract those strings out of phpbb3 (their translation system is my basis atm). I hope that i can write some small test programs to get familiar with the translation system.