views:

276

answers:

2

Hi!

I'm writing an application that is currently a pure QT4 app. It is designed to run cleanly on both Linux and Windows.

However I plan to integrate it a bit into KDE in future and here come the problems with localization/translations.

QT4 uses its own tr()/tr().arg().arg() mechanism and .ts/.qm files. KDE4 uses gettext and i18n/i18np mechanism and .po files.

How, easily, can I use KDE4's mechanism in my QT4 application without having to closely integrate it with KDE now (apparently making it non-runnable on Windows)?

Is it at all possible?

Thanks!

A: 

I think you will need to just pick one and go with it, if it is a cross platform app, I'd go with QT's method. The reason why is that KDE wraps it's internationalized string with i18*() macros and QT uses tr() macros, since a macro can't produce another macro, there is no way unless you have #ifdef's all over your code, or a massive string table...both of which suck.

Evan Teran
Hence my question: is it at all possible and easy to use KDE4 methods (gettext, po files) to avoid future need of converting all translation stuff.
Marcin Gil
Well my answer is "there is no good solution for both right now." from Henrik Hartz's answer, it looks like QT 4.5 will improve that though.
Evan Teran
+2  A: 

Starting version 4.5, Qt will support both .po and .xliff;

http://doc.trolltech.com/4.5/qt4-5-intro.html#qt-linguist-improvements

Henrik Hartz
So I'm going pure QT4 way. Thanks!
Marcin Gil