|
|
@ -511,36 +511,26 @@ void Application::initializeTranslation() |
|
|
|
{ |
|
|
|
{ |
|
|
|
Preferences* const pref = Preferences::instance(); |
|
|
|
Preferences* const pref = Preferences::instance(); |
|
|
|
// Load translation
|
|
|
|
// Load translation
|
|
|
|
QString locale = pref->getLocale(); |
|
|
|
QString localeStr = pref->getLocale(); |
|
|
|
|
|
|
|
|
|
|
|
if (locale.isEmpty()) { |
|
|
|
if ( |
|
|
|
locale = QLocale::system().name(); |
|
|
|
|
|
|
|
pref->setLocale(locale); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_qtTranslator.load( |
|
|
|
|
|
|
|
#ifdef QBT_USES_QT5 |
|
|
|
#ifdef QBT_USES_QT5 |
|
|
|
QString::fromUtf8("qtbase_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) || |
|
|
|
m_qtTranslator.load(QString::fromUtf8("qtbase_") + localeStr, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) || |
|
|
|
m_qtTranslator.load( |
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
QString::fromUtf8("qt_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) { |
|
|
|
m_qtTranslator.load(QString::fromUtf8("qt_") + localeStr, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) |
|
|
|
qDebug("Qt %s locale recognized, using translation.", qPrintable(locale)); |
|
|
|
qDebug("Qt %s locale recognized, using translation.", qPrintable(localeStr)); |
|
|
|
} |
|
|
|
else |
|
|
|
else { |
|
|
|
qDebug("Qt %s locale unrecognized, using default (en).", qPrintable(localeStr)); |
|
|
|
qDebug("Qt %s locale unrecognized, using default (en).", qPrintable(locale)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
installTranslator(&m_qtTranslator); |
|
|
|
installTranslator(&m_qtTranslator); |
|
|
|
|
|
|
|
|
|
|
|
if (m_translator.load(QString::fromUtf8(":/lang/qbittorrent_") + locale)) { |
|
|
|
if (m_translator.load(QString::fromUtf8(":/lang/qbittorrent_") + localeStr)) |
|
|
|
qDebug("%s locale recognized, using translation.", qPrintable(locale)); |
|
|
|
qDebug("%s locale recognized, using translation.", qPrintable(localeStr)); |
|
|
|
} |
|
|
|
else |
|
|
|
else { |
|
|
|
qDebug("%s locale unrecognized, using default (en).", qPrintable(localeStr)); |
|
|
|
qDebug("%s locale unrecognized, using default (en).", qPrintable(locale)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
installTranslator(&m_translator); |
|
|
|
installTranslator(&m_translator); |
|
|
|
|
|
|
|
|
|
|
|
#ifndef DISABLE_GUI |
|
|
|
#ifndef DISABLE_GUI |
|
|
|
if (locale.startsWith("ar") || locale.startsWith("he")) { |
|
|
|
if (localeStr.startsWith("ar") || localeStr.startsWith("he")) { |
|
|
|
qDebug("Right to Left mode"); |
|
|
|
qDebug("Right to Left mode"); |
|
|
|
setLayoutDirection(Qt::RightToLeft); |
|
|
|
setLayoutDirection(Qt::RightToLeft); |
|
|
|
} |
|
|
|
} |
|
|
|