简体   繁体   中英

Using KDE4 localization mechanisms in pure QT4 application

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!

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM