From fdf0e9c28c05a8d497a19414099d74f9a0f5d970 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 1 Jul 2018 11:49:53 +0200 Subject: Add browser.locale and browser.translation --- src/main.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index a419775..85bf5f0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,6 +14,8 @@ #include #include "plugin.h" #include "session.h" +#include +#include int main(int argc, char **argv) { @@ -83,6 +85,24 @@ int main(int argc, char **argv) app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true); app.setConfiguration(config); + // translator + if(config->exists("browser.locale")) { + auto *translator = new QTranslator(&app); + if(translator->load("qt_" + config->value("browser.locale").value(), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) + app.installTranslator(translator); + else + delete translator; + } + + if(config->exists("browser.translation")) { + auto *translator = new QTranslator(&app); + if(translator->load(config->value("browser.translation").value())) + app.installTranslator(translator); + else + delete translator; + } + + app.setup(QString::fromStdString(config->value("profile.default").value())); for(const Plugin &plugin : plugins) { app.registerPlugin(plugin); -- cgit v1.2.1