Commit 2f005a53 authored by Urs Fleisch's avatar Urs Fleisch
Browse files

Qt5: Use qtbase_LANG.qm instead of qt_LANG.qm for Qt translations.

parent 8ccce1ac
......@@ -2323,7 +2323,7 @@ done
for f in po/*.qm; do
l=${f#*_};
l=${l%.qm};
test -f $QT_TRANSLATIONS_DIR/qt_$l.qm && cp $QT_TRANSLATIONS_DIR/qt_$l.qm $INSTDIR
test -f $QT_TRANSLATIONS_DIR/qtbase_$l.qm && cp $QT_TRANSLATIONS_DIR/qtbase_$l.qm $INSTDIR
done
rm -f $INSTDIR.zip
......
......@@ -19,13 +19,18 @@ if (APPLE OR WIN32)
set(_qtQmFiles)
set(_qtTsFiles)
if (HAVE_QT5)
set(_qttranslation_prefix "${QT_TRANSLATIONS_DIR}/qtbase_")
else (HAVE_QT5)
set(_qttranslation_prefix "${QT_TRANSLATIONS_DIR}/qt_")
endif (HAVE_QT5)
foreach (_currentPoFile ${_poFiles})
get_filename_component(_lang ${_currentPoFile} NAME_WE)
if (EXISTS ${QT_TRANSLATIONS_DIR}/qt_${_lang}.qm)
set(_qtQmFiles ${_qtQmFiles} ${QT_TRANSLATIONS_DIR}/qt_${_lang}.qm)
elseif (EXISTS ${QT_TRANSLATIONS_DIR}/qt_${_lang}.ts)
set(_qtTsFiles ${_qtTsFiles} ${QT_TRANSLATIONS_DIR}/qt_${_lang}.ts)
endif (EXISTS ${QT_TRANSLATIONS_DIR}/qt_${_lang}.qm)
if (EXISTS ${_qttranslation_prefix}${_lang}.qm)
set(_qtQmFiles ${_qtQmFiles} ${_qttranslation_prefix}${_lang}.qm)
elseif (EXISTS ${_qttranslation_prefix}${_lang}.ts)
set(_qtTsFiles ${_qtTsFiles} ${_qttranslation_prefix}${_lang}.ts)
endif (EXISTS ${_qttranslation_prefix}${_lang}.qm)
endforeach (_currentPoFile)
endif (APPLE OR WIN32)
......
......@@ -33,6 +33,16 @@
#include <QFileInfo>
#include "config.h"
namespace {
#if QT_VERSION >= 0x050000
const char* const QT_TRANSLATION_PREFIX = "qtbase_";
#else
const char* const QT_TRANSLATION_PREFIX = "qt_";
#endif
}
/**
* @brief Load application translation.
*
......@@ -71,12 +81,12 @@ void Utils::loadTranslation(const QString& lang)
localeName.startsWith(QLatin1String("en")) ||
#if defined Q_OS_WIN32 || defined Q_OS_MAC
(!translationsDir.isNull() &&
qtTr->load(QLatin1String("qt_") + localeName, translationsDir,
searchDelimiters)) ||
qtTr->load(QLatin1String("qt_") + localeName, QLatin1String("."),
searchDelimiters)
qtTr->load(QLatin1String(QT_TRANSLATION_PREFIX) + localeName,
translationsDir, searchDelimiters)) ||
qtTr->load(QLatin1String(QT_TRANSLATION_PREFIX) + localeName,
QLatin1String("."), searchDelimiters)
#else
qtTr->load(QLatin1String("qt_") + localeName,
qtTr->load(QLatin1String(QT_TRANSLATION_PREFIX) + localeName,
QLibraryInfo::location(QLibraryInfo::TranslationsPath),
searchDelimiters)
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment