From 8cf00ba5e1879d028dca7a59bb99edfc313eef86 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sat, 5 May 2018 19:58:18 +0800 Subject: [PATCH] Fix translation strings not found The translation context doesn't exist, so the translations were not found, fixed now. Closes #8829. --- src/base/search/searchpluginmanager.cpp | 25 ++++++++++++------------- src/base/search/searchpluginmanager.h | 1 - 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/base/search/searchpluginmanager.cpp b/src/base/search/searchpluginmanager.cpp index 89d08c98e..b1df35c92 100644 --- a/src/base/search/searchpluginmanager.cpp +++ b/src/base/search/searchpluginmanager.cpp @@ -62,18 +62,6 @@ namespace QPointer SearchPluginManager::m_instance = nullptr; -const QHash SearchPluginManager::m_categoryNames { - {"all", QT_TRANSLATE_NOOP("SearchEngine", "All categories")}, - {"movies", QT_TRANSLATE_NOOP("SearchEngine", "Movies")}, - {"tv", QT_TRANSLATE_NOOP("SearchEngine", "TV shows")}, - {"music", QT_TRANSLATE_NOOP("SearchEngine", "Music")}, - {"games", QT_TRANSLATE_NOOP("SearchEngine", "Games")}, - {"anime", QT_TRANSLATE_NOOP("SearchEngine", "Anime")}, - {"software", QT_TRANSLATE_NOOP("SearchEngine", "Software")}, - {"pictures", QT_TRANSLATE_NOOP("SearchEngine", "Pictures")}, - {"books", QT_TRANSLATE_NOOP("SearchEngine", "Books")} -}; - SearchPluginManager::SearchPluginManager() : m_updateUrl(QString("http://searchplugins.qbittorrent.org/%1/engines/").arg(Utils::Misc::pythonVersion() >= 3 ? "nova3" : "nova")) { @@ -307,7 +295,18 @@ SearchHandler *SearchPluginManager::startSearch(const QString &pattern, const QS QString SearchPluginManager::categoryFullName(const QString &categoryName) { - return tr(m_categoryNames.value(categoryName).toUtf8().constData()); + static const QHash categoryTable { + {"all", tr("All categories")}, + {"movies", tr("Movies")}, + {"tv", tr("TV shows")}, + {"music", tr("Music")}, + {"games", tr("Games")}, + {"anime", tr("Anime")}, + {"software", tr("Software")}, + {"pictures", tr("Pictures")}, + {"books", tr("Books")} + }; + return categoryTable.value(categoryName); } QString SearchPluginManager::pluginFullName(const QString &pluginName) diff --git a/src/base/search/searchpluginmanager.h b/src/base/search/searchpluginmanager.h index 536d012c7..89294af83 100644 --- a/src/base/search/searchpluginmanager.h +++ b/src/base/search/searchpluginmanager.h @@ -111,7 +111,6 @@ private: static QString pluginPath(const QString &name); static QPointer m_instance; - static const QHash m_categoryNames; const QString m_updateUrl;