From bdd4d3cbe99a4859af8c780f7aae2eef5cd8c18c Mon Sep 17 00:00:00 2001 From: aqua Date: Sat, 3 Sep 2022 19:23:45 +0300 Subject: Add translations to CMakeLists --- CMakeLists.txt | 3 +- i18n/rekonq_bg.ts | 262 ++++++++++++++++++++++++++++++++++++++++++++++++++++ i18n/rekonq_en.ts | 262 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/application.cpp | 12 +++ src/main.cpp | 4 +- 5 files changed, 540 insertions(+), 3 deletions(-) create mode 100644 i18n/rekonq_bg.ts create mode 100644 i18n/rekonq_en.ts diff --git a/CMakeLists.txt b/CMakeLists.txt index 43efafac..d8aa0480 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ include(FeatureSummary) include(GNUInstallDirs) find_package(spdlog REQUIRED) -find_package(Qt6 6.3.0 COMPONENTS Core Gui Network WebEngineWidgets REQUIRED) +find_package(Qt6 6.3.0 COMPONENTS Core Gui Network WebEngineWidgets LinguistTools REQUIRED) # turn on automatic moc/uic/rcc for all targets set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) @@ -120,6 +120,7 @@ target_link_libraries(rekonq ) add_custom_target(rekonq_check_license python scripts/check_license.py ${rekonq_SRCS} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) +qt_add_translations(rekonq TS_FILES i18n/rekonq_bg.ts i18n/rekonq_en.ts) # ================================================================================ diff --git a/i18n/rekonq_bg.ts b/i18n/rekonq_bg.ts new file mode 100644 index 00000000..45075a88 --- /dev/null +++ b/i18n/rekonq_bg.ts @@ -0,0 +1,262 @@ + + + + + RekonqView_fake + + + + RekonqView_fake + + + + + Progress + + + + + Title + + + + + URL + + + + + + ... + + + + + rekonq__debug + + + + + RekonqWindow + + + rekonq + + + + + Add Tab + + + + + Back + + + + + Forward + + + + + Reload + + + + + Home + + + + + Load + + + + + Menu + + + + + File + Файл + + + + Edit + + + + + View + + + + + History + История + + + + Bookmarks + Отметки + + + + Settings + Настройки + + + + Help + + + + + Task Manager + + + + + F12 + + + + + Close Window + + + + + Configure rekonq + + + + + &Quit + + + + + Ctrl+Q + + + + + About Qt + + + + + New Tab + + + + + Ctrl+T + + + + + Close Tab + + + + + Ctrl+W + + + + + New Debug Tab + + + + + TaskManager + + + Task Manager + + + + + Plugins + + + + + Plugin State + + + + + State + + + + + Error + + + + + Schemes + + + + + Windows + + + + + Views + + + + + Loaded + + + + + Not loaded + + + + + UrlBar + + + + Type here to search your bookmarks, history and the web... + + + + + main + + + Open in incognito mode + + + + + Open URL as web app (in a simple window) + + + + + Add plugin to load path + + + + + Location to open + + + + diff --git a/i18n/rekonq_en.ts b/i18n/rekonq_en.ts new file mode 100644 index 00000000..c76d8d0b --- /dev/null +++ b/i18n/rekonq_en.ts @@ -0,0 +1,262 @@ + + + + + RekonqView_fake + + + + RekonqView_fake + + + + + Progress + + + + + Title + + + + + URL + + + + + + ... + + + + + rekonq__debug + + + + + RekonqWindow + + + rekonq + + + + + Add Tab + + + + + Back + + + + + Forward + + + + + Reload + + + + + Home + + + + + Load + + + + + Menu + + + + + File + + + + + Edit + + + + + View + + + + + History + + + + + Bookmarks + + + + + Settings + + + + + Help + + + + + Task Manager + + + + + F12 + + + + + Close Window + + + + + Configure rekonq + + + + + &Quit + + + + + Ctrl+Q + + + + + About Qt + + + + + New Tab + + + + + Ctrl+T + + + + + Close Tab + + + + + Ctrl+W + + + + + New Debug Tab + + + + + TaskManager + + + Task Manager + + + + + Plugins + + + + + Plugin State + + + + + State + + + + + Error + + + + + Schemes + + + + + Windows + + + + + Views + + + + + Loaded + + + + + Not loaded + + + + + UrlBar + + + + Type here to search your bookmarks, history and the web... + + + + + main + + + Open in incognito mode + + + + + Open URL as web app (in a simple window) + + + + + Add plugin to load path + + + + + Location to open + + + + diff --git a/src/application.cpp b/src/application.cpp index 38ad7477..bdef20dd 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include // --------------------------------------------------------------------------------------------------------------- @@ -34,6 +35,17 @@ Application::Application(int &argc, char *argv[]) : SingleApplication(argc, argv spdlog::info("Loading rekonq configuration: {}", qUtf8Printable(settingsPath)); m_settings = new Settings(settingsPath, this); + // set localization + QLocale locale; + spdlog::info("Current locale: {}", qUtf8Printable(QLocale::territoryToString(locale.territory()))); + auto *translator = new QTranslator(this); + if (translator->load(locale, QL1S("rekonq"), QL1S("_"), QL1S(":/i18n"))) { + QCoreApplication::installTranslator(translator); + spdlog::info("Installed translations for locale"); + } + else + delete translator; + if (m_settings->value("FirstRun").toBool()) { spdlog::info("First run"); if ((new SettingsDialog(m_settings, nullptr))->exec()) spdlog::info("Settings saved"); diff --git a/src/main.cpp b/src/main.cpp index a537be8b..0dedacea 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,8 +31,8 @@ int main(int argc, char **argv) app.sendMessage(Application::arguments().join('\n').toUtf8()); return 0; } - else - app.parseCommandLine(app.instanceId(), {}); + + app.parseCommandLine(app.instanceId(), {}); /* -- cgit v1.2.1