From ef8c07e6eb0f44ca634f817e30351a39a33720fe Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 30 Apr 2024 17:35:34 +0300 Subject: [PATCH] Added ability to translate selected text in profile section. --- .../SourceFiles/info/profile/info_profile_actions.cpp | 11 +++++++++-- Telegram/lib_ui | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index c4ba688996..b7a14b484b 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -965,13 +965,20 @@ object_ptr DetailsFiller::setupInfo() { if (Ui::SkipTranslate(state->labelText.current())) { return; } - auto item = tr::lng_context_translate(tr::now); + auto item = (request.selection.empty() + ? tr::lng_context_translate + : tr::lng_context_translate_selected)(tr::now); request.menu->addAction(std::move(item), [=] { controller->window().show(Box( Ui::TranslateBox, peer, MsgId(), - state->labelText.current(), + request.selection.empty() + ? state->labelText.current() + : Ui::Text::Mid( + state->labelText.current(), + request.selection.from, + request.selection.to - request.selection.from), false)); }); }); diff --git a/Telegram/lib_ui b/Telegram/lib_ui index cb57bef3f0..08b56a1789 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit cb57bef3f01b7ec60eb0eae0ee68cd56cb3a9b1f +Subproject commit 08b56a17892d4c9c6b7ef87fcffbb64090e9ce2a