diff --git a/Telegram/Resources/langs/rewrites/en.json b/Telegram/Resources/langs/rewrites/en.json index c954bf986..f73e7ba69 100644 --- a/Telegram/Resources/langs/rewrites/en.json +++ b/Telegram/Resources/langs/rewrites/en.json @@ -173,6 +173,7 @@ "ktg_send_silent_preview": "Send preview silent", "ktg_reminder_preview": "Remind with preview", "ktg_schedule_preview": "Send preview scheduled", + "ktg_language_reloaded": "Kotatogram-specific language strings were reloaded.", "ktg_forward_sender_names_and_captions_removed": "Sender names and captions removed", "ktg_forward_remember_mode": "Remember forward mode", "ktg_forward_mode": "Forward mode", diff --git a/Telegram/SourceFiles/core/application.cpp b/Telegram/SourceFiles/core/application.cpp index 566baaf59..b12c7f13b 100644 --- a/Telegram/SourceFiles/core/application.cpp +++ b/Telegram/SourceFiles/core/application.cpp @@ -77,6 +77,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/gl/gl_detection.h" #include "ui/image/image.h" #include "ui/text/text_options.h" +#include "ui/toast/toast.h" #include "ui/emoji_config.h" #include "ui/effects/animations.h" #include "ui/effects/spoiler_mess.h" @@ -1761,6 +1762,13 @@ void Application::startShortcuts() { request->check(Command::Close) && request->handle([=] { return closeActiveWindow(); }); + request->check(Command::ReloadLang) && request->handle([=] { + Kotato::Lang::Load( + Lang::GetInstance().baseId(), + Lang::GetInstance().id()); + Ui::Toast::Show(ktr("ktg_language_reloaded")); + return true; + }); }, _lifetime); } diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index 49b75ebdc..d09136aa3 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -101,6 +101,7 @@ const auto CommandByName = base::flat_map{ { qsl("save_draft") , Command::SaveDraft }, { qsl("jump_to_date") , Command::JumpToDate }, + { qsl("reload_lang") , Command::ReloadLang }, }; const auto CommandNames = base::flat_map{ @@ -143,6 +144,7 @@ const auto CommandNames = base::flat_map{ { Command::SaveDraft , u"save_draft"_q }, { Command::JumpToDate , u"jump_to_date"_q }, + { Command::ReloadLang , u"reload_lang"_q }, }; class Manager { diff --git a/Telegram/SourceFiles/core/shortcuts.h b/Telegram/SourceFiles/core/shortcuts.h index 76407550d..508e8eabd 100644 --- a/Telegram/SourceFiles/core/shortcuts.h +++ b/Telegram/SourceFiles/core/shortcuts.h @@ -67,6 +67,7 @@ enum class Command { SaveDraft, JumpToDate, + ReloadLang, }; [[maybe_unused]] constexpr auto kShowFolder = { diff --git a/Telegram/SourceFiles/settings/settings_codes.cpp b/Telegram/SourceFiles/settings/settings_codes.cpp index 54af5b7b2..b822bc308 100644 --- a/Telegram/SourceFiles/settings/settings_codes.cpp +++ b/Telegram/SourceFiles/settings/settings_codes.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "settings/settings_codes.h" +#include "kotato/kotato_lang.h" #include "ui/toast/toast.h" #include "mainwidget.h" #include "mainwindow.h" @@ -249,6 +250,12 @@ auto GenerateCodes() { Data::CloudThemes::SetTestingColors(now); Ui::Toast::Show(now ? "Testing chat theme colors!" : "Not testing.."); }); + codes.emplace(qsl("reloadlang"), [](SessionController *window) { + Kotato::Lang::Load( + Lang::GetInstance().baseId(), + Lang::GetInstance().id()); + Ui::Toast::Show(ktr("ktg_language_reloaded")); + }); #ifdef Q_OS_MAC codes.emplace(u"customicon"_q, [](SessionController *window) {