Improved phrases in service message for started giveaway with credits.

This commit is contained in:
23rd 2024-08-31 09:28:11 +03:00 committed by John Preston
parent 0982aa166a
commit 99f857fbf6
2 changed files with 26 additions and 7 deletions

View file

@ -1891,6 +1891,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_action_story_mention_unavailable" = "The story where {user} mentioned you is no longer available.";
"lng_action_giveaway_started_group" = "{from} just started a giveaway of Telegram Premium subscriptions to its members.";
"lng_action_giveaway_started" = "{from} just started a giveaway of Telegram Premium subscriptions to its followers.";
"lng_action_giveaway_credits_started_amount#one" = "{count} Star";
"lng_action_giveaway_credits_started_amount#other" = "{count} Stars";
"lng_action_giveaway_credits_started_group" = "{from} just started a giveaway of {amount} to its members.";
"lng_action_giveaway_credits_started" = "{from} just started a giveaway of {amount} to its followers.";
"lng_action_giveaway_results#one" = "{count} winner of the giveaway was randomly selected by Telegram and received private messages with giftcodes.";
"lng_action_giveaway_results#other" = "{count} winners of the giveaway were randomly selected by Telegram and received private messages with giftcodes.";
"lng_action_giveaway_results_some" = "Some winners of the giveaway were randomly selected by Telegram and received private messages with giftcodes.";

View file

@ -5149,15 +5149,30 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
};
auto prepareGiveawayLaunch = [&](const MTPDmessageActionGiveawayLaunch &action) {
const auto credits = action.vstars().value_or_empty();
auto result = PreparedServiceText();
result.links.push_back(fromLink());
result.text = (_history->peer->isMegagroup()
? tr::lng_action_giveaway_started_group
: tr::lng_action_giveaway_started)(
tr::now,
lt_from,
fromLinkText(), // Link 1.
Ui::Text::WithEntities);
result.text = credits
? (_history->peer->isMegagroup()
? tr::lng_action_giveaway_credits_started_group
: tr::lng_action_giveaway_credits_started)(
tr::now,
lt_from,
fromLinkText(), // Link 1.
lt_amount,
tr::lng_action_giveaway_credits_started_amount(
tr::now,
lt_count_decimal,
float64(credits),
Ui::Text::Bold),
Ui::Text::WithEntities)
: (_history->peer->isMegagroup()
? tr::lng_action_giveaway_started_group
: tr::lng_action_giveaway_started)(
tr::now,
lt_from,
fromLinkText(), // Link 1.
Ui::Text::WithEntities);
return result;
};