Added phrases for single winner of giveaway in channels.

This commit is contained in:
23rd 2024-07-15 00:05:19 +03:00 committed by John Preston
parent 1d5e4040f4
commit 4b9eb37bd5
3 changed files with 17 additions and 4 deletions

View File

@ -2813,12 +2813,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_prizes_badge" = "x{amount}";
"lng_prizes_results_title" = "Winners Selected!";
"lng_prizes_results_title_one" = "Winner Selected!";
"lng_prizes_results_about#one" = "**{count}** winner of the {link} was randomly selected by Telegram.";
"lng_prizes_results_about#other" = "**{count}** winners of the {link} were randomly selected by Telegram.";
"lng_prizes_results_link" = "Giveaway";
"lng_prizes_results_winner" = "Winner";
"lng_prizes_results_winners" = "Winners";
"lng_prizes_results_more#one" = "and {count} more!";
"lng_prizes_results_more#other" = "and {count} more!";
"lng_prizes_results_one" = "The winner received their gift link in a private message.";
"lng_prizes_results_all" = "All winners received gift links in private messages.";
"lng_prizes_results_some" = "Some winners couldn't be selected.";

View File

@ -2631,7 +2631,11 @@ const GiveawayResults *MediaGiveawayResults::giveawayResults() const {
}
TextWithEntities MediaGiveawayResults::notificationText() const {
return Ui::Text::Colorized({ tr::lng_prizes_results_title(tr::now) });
return Ui::Text::Colorized({
((_data.winnersCount == 1)
? tr::lng_prizes_results_title_one
: tr::lng_prizes_results_title)(tr::now)
});
}
QString MediaGiveawayResults::pinnedTextSubstring() const {

View File

@ -200,9 +200,11 @@ auto GenerateGiveawayResults(
margins,
links));
};
const auto isSingleWinner = (data->winnersCount == 1);
pushText(
Ui::Text::Bold(
tr::lng_prizes_results_title(tr::now)),
(isSingleWinner
? tr::lng_prizes_results_title_one
: tr::lng_prizes_results_title)(tr::now, Ui::Text::Bold),
st::chatGiveawayPrizesTitleMargin);
const auto showGiveawayHandler = JumpToMessageClickHandler(
data->channel,
@ -219,7 +221,9 @@ auto GenerateGiveawayResults(
st::chatGiveawayPrizesMargin,
{ { 1, showGiveawayHandler } });
pushText(
Ui::Text::Bold(tr::lng_prizes_results_winners(tr::now)),
(isSingleWinner
? tr::lng_prizes_results_winner
: tr::lng_prizes_results_winners)(tr::now, Ui::Text::Bold),
st::chatGiveawayPrizesTitleMargin);
push(std::make_unique<PeerBubbleListPart>(
@ -235,6 +239,8 @@ auto GenerateGiveawayResults(
}
pushText({ data->unclaimedCount
? tr::lng_prizes_results_some(tr::now)
: isSingleWinner
? tr::lng_prizes_results_one(tr::now)
: tr::lng_prizes_results_all(tr::now)
}, st::chatGiveawayEndDateMargin);
};