Added ability to translate polls.

This commit is contained in:
23rd 2022-11-26 15:31:31 +03:00
parent c39b9e9635
commit 0b86caef67
1 changed files with 17 additions and 0 deletions

View File

@ -1130,6 +1130,23 @@ void AddPollActions(
not_null<HistoryItem*> item,
Context context,
not_null<Window::SessionController*> controller) {
{
constexpr auto kRadio = "\xf0\x9f\x94\x98";
const auto radio = QString::fromUtf8(kRadio);
auto text = poll->question;
for (const auto &answer : poll->answers) {
text += '\n' + radio + answer.text;
}
if (!Ui::SkipTranslate({ text })) {
menu->addAction(tr::lng_context_translate(tr::now), [=] {
Window::Show(controller).showBox(Box(
Ui::TranslateBox,
item->history()->peer,
MsgId(),
TextWithEntities{ .text = text }));
}, &st::menuIconTranslate);
}
}
if ((context != Context::History)
&& (context != Context::Replies)
&& (context != Context::Pinned)) {