diff --git a/Telegram/SourceFiles/core/local_url_handlers.cpp b/Telegram/SourceFiles/core/local_url_handlers.cpp index 03cb2ee9e3..f613e62a33 100644 --- a/Telegram/SourceFiles/core/local_url_handlers.cpp +++ b/Telegram/SourceFiles/core/local_url_handlers.cpp @@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/connection_box.h" #include "boxes/sticker_set_box.h" #include "boxes/sessions_box.h" +#include "boxes/language_box.h" #include "passport/passport_form_controller.h" #include "window/window_session_controller.h" #include "data/data_session.h" @@ -101,12 +102,21 @@ bool ShowTheme( return true; } +void ShowLanguagesBox() { + static auto Guard = base::binary_guard(); + Guard = LanguageBox::Show(); +} + bool SetLanguage( Main::Session *session, const Match &match, const QVariant &context) { - const auto languageId = match->captured(1); - Lang::CurrentCloudManager().switchWithWarning(languageId); + if (match->capturedRef(1).isEmpty()) { + ShowLanguagesBox(); + } else { + const auto languageId = match->captured(2); + Lang::CurrentCloudManager().switchWithWarning(languageId); + } return true; } @@ -351,6 +361,9 @@ bool ResolveSettings( if (section == qstr("devices")) { Ui::show(Box(session)); return true; + } else if (section == qstr("language")) { + ShowLanguagesBox(); + return true; } const auto type = (section == qstr("folders")) ? ::Settings::Type::Folders @@ -441,7 +454,7 @@ const std::vector &LocalUrlHandlers() { ShowTheme }, { - qsl("^setlanguage/?\\?lang=([a-zA-Z0-9\\.\\_\\-]+)(&|$)"), + qsl("^setlanguage/?(\\?lang=([a-zA-Z0-9\\.\\_\\-]+))?(&|$)"), SetLanguage }, { @@ -481,7 +494,7 @@ const std::vector &LocalUrlHandlers() { ResolvePrivatePost }, { - qsl("^settings(/folders|/devices)?$"), + qsl("^settings(/folders|/devices|/language)?$"), ResolveSettings }, {