diff --git a/Telegram/Resources/langs/rewrites/en.json b/Telegram/Resources/langs/rewrites/en.json index 9173a778b..33a141362 100644 --- a/Telegram/Resources/langs/rewrites/en.json +++ b/Telegram/Resources/langs/rewrites/en.json @@ -207,6 +207,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_notifications_mute_seconds": { "zero": "seconds", "one": "second", diff --git a/Telegram/SourceFiles/core/application.cpp b/Telegram/SourceFiles/core/application.cpp index 199d371fa..13df129ef 100644 --- a/Telegram/SourceFiles/core/application.cpp +++ b/Telegram/SourceFiles/core/application.cpp @@ -69,6 +69,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/cached_round_corners.h" @@ -1275,6 +1276,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 0b261aab3..acdf42234 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -100,6 +100,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{ @@ -142,6 +143,7 @@ const auto CommandNames = base::flat_map{ { Command::SaveDraft , qsl("save_draft") }, { Command::JumpToDate , qsl("jump_to_date") }, + { Command::ReloadLang , qsl("reload_lang") }, }; class Manager { diff --git a/Telegram/SourceFiles/core/shortcuts.h b/Telegram/SourceFiles/core/shortcuts.h index 606763246..279aebc9d 100644 --- a/Telegram/SourceFiles/core/shortcuts.h +++ b/Telegram/SourceFiles/core/shortcuts.h @@ -64,6 +64,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 7e688a137..762900534 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 "platform/platform_specific.h" #include "ui/toast/toast.h" #include "mainwidget.h" @@ -272,6 +273,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(qsl("customicon"), [](SessionController *window) {