2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 14:08:41 +00:00

Added ability to translate selected text in profile section.

This commit is contained in:
23rd
2024-04-30 17:35:34 +03:00
parent 20a13663a6
commit ef8c07e6eb
2 changed files with 10 additions and 3 deletions

View File

@@ -965,13 +965,20 @@ object_ptr<Ui::RpWidget> 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));
});
});