Fix memory leaks
This commit is contained in:
18
src/main.cpp
18
src/main.cpp
@@ -90,7 +90,7 @@
|
||||
#include "core/networkproxyfactory.h"
|
||||
#include "core/scangiomodulepath.h"
|
||||
#ifdef HAVE_TRANSLATIONS
|
||||
# include "core/potranslator.h"
|
||||
# include "core/translations.h"
|
||||
#endif
|
||||
#include "settings/behavioursettingspage.h"
|
||||
|
||||
@@ -228,12 +228,18 @@ int main(int argc, char* argv[]) {
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
const QString language = override_language.isEmpty() ? Utilities::SystemLanguageName() : override_language;
|
||||
QString system_language = QLocale::system().uiLanguages().empty() ? QLocale::system().name() : QLocale::system().uiLanguages().first();
|
||||
// uiLanguages returns strings with "-" as separators for language/region; however QTranslator needs "_" separators
|
||||
system_language.replace("-", "_");
|
||||
|
||||
Utilities::LoadTranslation("qt", QLibraryInfo::location(QLibraryInfo::TranslationsPath), language);
|
||||
Utilities::LoadTranslation("strawberry", ":/translations", language);
|
||||
Utilities::LoadTranslation("strawberry", a.applicationDirPath(), language);
|
||||
Utilities::LoadTranslation("strawberry", QDir::currentPath(), language);
|
||||
const QString language = override_language.isEmpty() ? system_language : override_language;
|
||||
|
||||
std::unique_ptr<Translations> translations(new Translations);
|
||||
|
||||
translations->LoadTranslation("qt", QLibraryInfo::location(QLibraryInfo::TranslationsPath), language);
|
||||
translations->LoadTranslation("strawberry", ":/translations", language);
|
||||
translations->LoadTranslation("strawberry", a.applicationDirPath(), language);
|
||||
translations->LoadTranslation("strawberry", QDir::currentPath(), language);
|
||||
#endif
|
||||
|
||||
Application app;
|
||||
|
||||
Reference in New Issue
Block a user