Translate text for current Qt(not both Qt4 & Qt5). (#793)

Check Qt version on compile time, and translate text for current Qt version.
This commit is contained in:
Boris Barbulovski 2016-05-16 22:02:31 +02:00 committed by PKEuS
parent 99fc13ee70
commit 69cc64a717
1 changed files with 5 additions and 2 deletions

View File

@ -29,16 +29,19 @@
// Provide own translations for standard buttons. This (garbage) code is needed to enforce them to appear in .ts files even after "lupdate gui.pro"
static void unused()
{
// Qt4
#if ((QT_VERSION >= 0x040000)&&(QT_VERSION < 0x050000))
Q_UNUSED(QT_TRANSLATE_NOOP("QDialogButtonBox", "OK"));
Q_UNUSED(QT_TRANSLATE_NOOP("QDialogButtonBox", "Cancel"));
Q_UNUSED(QT_TRANSLATE_NOOP("QDialogButtonBox", "Close"));
Q_UNUSED(QT_TRANSLATE_NOOP("QDialogButtonBox", "Save"));
// Qt5
#elif ((QT_VERSION >= 0x050000)&&(QT_VERSION < 0x060000))
Q_UNUSED(QT_TRANSLATE_NOOP("QPlatformTheme", "OK"));
Q_UNUSED(QT_TRANSLATE_NOOP("QPlatformTheme", "Cancel"));
Q_UNUSED(QT_TRANSLATE_NOOP("QPlatformTheme", "Close"));
Q_UNUSED(QT_TRANSLATE_NOOP("QPlatformTheme", "Save"));
#else
#error Unsupported Qt version.
#endif
}
TranslationHandler::TranslationHandler(QObject *parent) :