[Improvement] Shortcut and settings code to reload language
This commit is contained in:
parent
39fadee372
commit
ced2a74e3f
5 changed files with 19 additions and 0 deletions
|
|
@ -193,6 +193,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",
|
||||
|
|
|
|||
|
|
@ -74,6 +74,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"
|
||||
|
|
@ -1450,6 +1451,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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ const auto CommandByName = base::flat_map<QString, Command>{
|
|||
|
||||
{ qsl("save_draft") , Command::SaveDraft },
|
||||
{ qsl("jump_to_date") , Command::JumpToDate },
|
||||
{ qsl("reload_lang") , Command::ReloadLang },
|
||||
};
|
||||
|
||||
const auto CommandNames = base::flat_map<Command, QString>{
|
||||
|
|
@ -142,6 +143,7 @@ const auto CommandNames = base::flat_map<Command, QString>{
|
|||
|
||||
{ Command::SaveDraft , qsl("save_draft") },
|
||||
{ Command::JumpToDate , qsl("jump_to_date") },
|
||||
{ Command::ReloadLang , qsl("reload_lang") },
|
||||
};
|
||||
|
||||
class Manager {
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ enum class Command {
|
|||
|
||||
SaveDraft,
|
||||
JumpToDate,
|
||||
ReloadLang,
|
||||
};
|
||||
|
||||
[[maybe_unused]] constexpr auto kShowFolder = {
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -274,6 +275,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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue