简体   繁体   English

在纯QT4应用程序中使用KDE4本地化机制

[英]Using KDE4 localization mechanisms in pure QT4 application

I'm writing an application that is currently a pure QT4 app. 我正在编写一个目前是纯QT4应用程序的应用程序。 It is designed to run cleanly on both Linux and Windows. 它旨在在Linux和Windows上干净利落地运行。

However I plan to integrate it a bit into KDE in future and here come the problems with localization/translations. 但是我计划将来将它集成到KDE中,这里出现了本地化/翻译的问题。

QT4 uses its own tr()/tr().arg().arg() mechanism and .ts/.qm files. QT4使用自己的tr()/ tr()。arg()。arg()机制和.ts / .qm文件。 KDE4 uses gettext and i18n/i18np mechanism and .po files. KDE4使用gettext和i18n / i18np机制和.po文件。

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)? 如何轻松地在我的QT4应用程序中使用KDE4的机制而不必将其与KDE紧密集成(显然在Windows上不可运行)?

Is it at all possible? 它可能吗?

Thanks! 谢谢!

Starting version 4.5, Qt will support both .po and .xliff; 从4.5版开始,Qt将支持.po和.xliff;

http://doc.trolltech.com/4.5/qt4-5-intro.html#qt-linguist-improvements 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. 我认为你需要选择一个并使用它,如果它是一个跨平台的应用程序,我会选择QT的方法。 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. 原因是KDE用i18 *()宏包装它的国际化字符串而QT使用tr()宏,因为宏不能生成另一个宏,除非你的代码中有#ifdef,否则没有办法巨大的字符串表......两者都很糟糕。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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