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));
});
});

@ -1 +1 @@
Subproject commit cb57bef3f01b7ec60eb0eae0ee68cd56cb3a9b1f
Subproject commit 08b56a17892d4c9c6b7ef87fcffbb64090e9ce2a