Improve gifts phrases.

This commit is contained in:
John Preston 2025-01-27 19:24:16 +04:00
parent da426ae03b
commit 1cc5988c40
2 changed files with 62 additions and 27 deletions

View file

@ -2026,13 +2026,19 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_action_gift_unique_sent" = "You sent a unique collectible item";
"lng_action_gift_upgraded" = "{user} turned the gift from you into a unique collectible";
"lng_action_gift_upgraded_channel" = "{user} turned this gift to {channel} into a unique collectible";
"lng_action_gift_upgraded_self_channel" = "You turned this gift to {channel} into a unique collectible";
"lng_action_gift_upgraded_mine" = "You turned the gift from {user} into a unique collectible";
"lng_action_gift_upgraded_self" = "You turned this gift into a unique collectible";
"lng_action_gift_transferred" = "{user} transferred you a gift";
"lng_action_gift_transferred_channel" = "{user} transferred a gift to {channel}";
"lng_action_gift_transferred_unknown" = "Someone transferred you a gift";
"lng_action_gift_transferred_unknown_channel" = "Someone transferred a gift to {channel}";
"lng_action_gift_transferred_self" = "You transferred a unique collectible";
"lng_action_gift_transferred_self_channel" = "You transferred a gift to {channel}";
"lng_action_gift_transferred_mine" = "You transferred a gift to {user}";
"lng_action_gift_received_anonymous" = "Unknown user sent you a gift for {cost}";
"lng_action_gift_sent_channel" = "{user} sent a gift to {name} for {cost}";
"lng_action_gift_sent_self_channel" = "You sent a gift to {name} for {cost}";
"lng_action_gift_self_bought" = "You bought a gift for {cost}";
"lng_action_gift_self_subtitle" = "Saved Gift";
"lng_action_gift_self_about#one" = "Display this gift on your page or convert it to **{count}** Star.";

View file

@ -5456,17 +5456,28 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
const auto from = fromId ? peer->owner().peer(fromId) : peer;
const auto channel = peer->owner().channel(
peerToChannel(giftPeer));
result.links.push_back(from->createOpenLink());
result.links.push_back(channel->createOpenLink());
result.text = tr::lng_action_gift_sent_channel(
tr::now,
lt_user,
Ui::Text::Link(from->shortName(), 1),
lt_name,
Ui::Text::Link(channel->name(), 2),
lt_cost,
cost,
Ui::Text::WithEntities);
if (from->isSelf()) {
result.links.push_back(channel->createOpenLink());
result.text = tr::lng_action_gift_sent_self_channel(
tr::now,
lt_name,
Ui::Text::Link(channel->name(), 1),
lt_cost,
cost,
Ui::Text::WithEntities);
} else {
result.links.push_back(from->createOpenLink());
result.links.push_back(channel->createOpenLink());
result.text = tr::lng_action_gift_sent_channel(
tr::now,
lt_user,
Ui::Text::Link(from->shortName(), 1),
lt_name,
Ui::Text::Link(channel->name(), 2),
lt_cost,
cost,
Ui::Text::WithEntities);
}
} else if (anonymous || _history->peer->isSelf()) {
result.text = (anonymous
? tr::lng_action_gift_received_anonymous
@ -5512,24 +5523,33 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
if (toChannel) {
const auto channel = peer->owner().channel(
peerToChannel(giftPeer));
result.links.push_back(from->createOpenLink());
if (!from->isServiceUser() && !from->isSelf()) {
result.links.push_back(from->createOpenLink());
result.text = (action.is_upgrade()
? tr::lng_action_gift_upgraded_channel
: tr::lng_action_gift_transferred_channel)(
tr::now,
lt_user,
Ui::Text::Link(from->shortName(), 1),
lt_channel,
Ui::Text::Link(channel->name(), 2),
Ui::Text::WithEntities);
} else {
result.text = (from->isServiceUser()
? tr::lng_action_gift_transferred_unknown_channel
: action.is_upgrade()
? tr::lng_action_gift_upgraded_self_channel
: tr::lng_action_gift_transferred_self_channel)(
tr::now,
lt_channel,
Ui::Text::Link(channel->name(), 1),
Ui::Text::WithEntities);
}
result.links.push_back(channel->createOpenLink());
result.text = (action.is_upgrade()
? tr::lng_action_gift_upgraded_channel
: tr::lng_action_gift_transferred_channel)(
tr::now,
lt_user,
Ui::Text::Link(from->shortName(), 1),
lt_channel,
Ui::Text::Link(channel->name(), 2),
Ui::Text::WithEntities);
} else {
result.links.push_back(peer->createOpenLink());
result.text = _history->peer->isSelf()
? tr::lng_action_gift_upgraded_self(
tr::now,
Ui::Text::WithEntities)
: (action.is_upgrade()
if (!from->isServiceUser() && !_history->peer->isSelf()) {
result.links.push_back(from->createOpenLink());
result.text = (action.is_upgrade()
? (isSelf
? tr::lng_action_gift_upgraded_mine
: tr::lng_action_gift_upgraded)
@ -5540,6 +5560,15 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
lt_user,
Ui::Text::Link(from->shortName(), 1), // Link 1.
Ui::Text::WithEntities);
} else {
result.text = (from->isServiceUser()
? tr::lng_action_gift_transferred_unknown
: action.is_upgrade()
? tr::lng_action_gift_upgraded_self
: tr::lng_action_gift_transferred_self)(
tr::now,
Ui::Text::WithEntities);
}
}
return result;
};