mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02:00
Added ability to translate polls.
This commit is contained in:
parent
c39b9e9635
commit
0b86caef67
1 changed files with 17 additions and 0 deletions
|
@ -1130,6 +1130,23 @@ void AddPollActions(
|
||||||
not_null<HistoryItem*> item,
|
not_null<HistoryItem*> item,
|
||||||
Context context,
|
Context context,
|
||||||
not_null<Window::SessionController*> controller) {
|
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)
|
if ((context != Context::History)
|
||||||
&& (context != Context::Replies)
|
&& (context != Context::Replies)
|
||||||
&& (context != Context::Pinned)) {
|
&& (context != Context::Pinned)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue