Use more simple tr::... text helpers.

This commit is contained in:
John Preston
2025-12-15 12:15:25 +04:00
parent 629158fedb
commit 08a979e638
213 changed files with 1657 additions and 1643 deletions

View File

@@ -238,7 +238,7 @@ void AwayMessage::setupContent(
.lottieSize = st::settingsCloudPasswordIconSize,
.lottieMargins = st::peerAppearanceIconPadding,
.showFinished = showFinishes(),
.about = tr::lng_away_about(Ui::Text::WithEntities),
.about = tr::lng_away_about(tr::marked),
.aboutMargins = st::peerAppearanceCoverLabelMargin,
});

View File

@@ -720,7 +720,7 @@ void ChatLinks::setupContent(
.lottieSize = st::settingsCloudPasswordIconSize,
.lottieMargins = st::peerAppearanceIconPadding,
.showFinished = showFinishes() | rpl::take(1),
.about = tr::lng_chat_links_about(Ui::Text::WithEntities),
.about = tr::lng_chat_links_about(tr::marked),
.aboutMargins = st::peerAppearanceCoverLabelMargin,
});
@@ -783,11 +783,11 @@ void ChatLinks::setupContent(
? tr::lng_chat_links_footer_both(
tr::now,
lt_username,
Ui::Text::Link(links[0], "https://" + links[0]),
tr::link(links[0], "https://" + links[0]),
lt_link,
Ui::Text::Link(links[1], "https://" + links[1]),
Ui::Text::WithEntities)
: Ui::Text::Link(links[0], "https://" + links[0]);
tr::link(links[1], "https://" + links[1]),
tr::marked)
: tr::link(links[0], "https://" + links[0]);
};
auto links = !username.isEmpty()
? make({ username, '+' + self->phone() })
@@ -797,7 +797,7 @@ void ChatLinks::setupContent(
tr::lng_chat_links_footer(
lt_links,
rpl::single(std::move(links)),
Ui::Text::WithEntities),
tr::marked),
st::boxDividerLabel);
label->setClickHandlerFilter([=](ClickHandlerPtr handler, auto) {
QGuiApplication::clipboard()->setText(handler->url());

View File

@@ -429,8 +429,8 @@ void Chatbots::setupContent() {
.about = tr::lng_chatbots_about(
lt_link,
tr::lng_chatbots_about_link(
) | Ui::Text::ToLink(tr::lng_chatbots_info_url(tr::now)),
Ui::Text::WithEntities),
tr::url(tr::lng_chatbots_info_url(tr::now))),
tr::marked),
.aboutMargins = st::peerAppearanceCoverLabelMargin,
});
@@ -524,7 +524,7 @@ void Chatbots::refreshDetails() {
) | rpl::on_next([=](Data::ChatbotsPermissions now) {
const auto warn = [&](tr::phrase<lngtag_bot> text) {
controller()->show(Ui::MakeInformBox({
.text = text(tr::now, lt_bot, Ui::Text::Bold(bot->name()), Ui::Text::RichLangValue),
.text = text(tr::now, lt_bot, tr::bold(bot->name()), tr::rich),
.title = tr::lng_chatbots_warning_title(),
}));
};

View File

@@ -135,7 +135,7 @@ void Greeting::setupContent(
.lottieSize = st::settingsCloudPasswordIconSize,
.lottieMargins = st::peerAppearanceIconPadding,
.showFinished = showFinishes(),
.about = tr::lng_greeting_about(Ui::Text::WithEntities),
.about = tr::lng_greeting_about(tr::marked),
.aboutMargins = st::peerAppearanceCoverLabelMargin,
});

View File

@@ -123,7 +123,7 @@ void Location::setupPicker(not_null<Ui::VerticalLayout*> content) {
.lottieSize = st::settingsCloudPasswordIconSize,
.lottieMargins = st::peerAppearanceIconPadding,
.showFinished = showFinishes(),
.about = tr::lng_location_about(Ui::Text::WithEntities),
.about = tr::lng_location_about(tr::marked),
.aboutMargins = st::peerAppearanceCoverLabelMargin,
});
@@ -273,7 +273,7 @@ void Location::setupUnsupported(not_null<Ui::VerticalLayout*> content) {
.lottieSize = st::settingsCloudPasswordIconSize,
.lottieMargins = st::peerAppearanceIconPadding,
.showFinished = showFinishes(),
.about = tr::lng_location_fallback(Ui::Text::WithEntities),
.about = tr::lng_location_fallback(tr::marked),
.aboutMargins = st::peerAppearanceCoverLabelMargin,
.parts = RectPart::Top,
});

View File

@@ -73,7 +73,7 @@ void QuickReplies::setupContent(
.lottieSize = st::settingsCloudPasswordIconSize,
.lottieMargins = st::peerAppearanceIconPadding,
.showFinished = showFinishes(),
.about = tr::lng_replies_about(Ui::Text::WithEntities),
.about = tr::lng_replies_about(tr::marked),
.aboutMargins = st::peerAppearanceCoverLabelMargin,
});
Ui::AddSkip(content);

View File

@@ -420,21 +420,21 @@ void ShortcutMessages::refreshEmptyText() {
auto text = away
? tr::lng_away_empty_title(
tr::now,
Ui::Text::Bold
tr::bold
).append("\n\n").append(tr::lng_away_empty_about(tr::now))
: greeting
? tr::lng_greeting_empty_title(
tr::now,
Ui::Text::Bold
tr::bold
).append("\n\n").append(tr::lng_greeting_empty_about(tr::now))
: tr::lng_replies_empty_title(
tr::now,
Ui::Text::Bold
tr::bold
).append("\n\n").append(tr::lng_replies_empty_about(
tr::now,
lt_shortcut,
Ui::Text::Bold('/' + shortcut),
Ui::Text::WithEntities));
tr::bold('/' + shortcut),
tr::marked));
_emptyIcon = away
? &st::awayEmptyIcon
: greeting

View File

@@ -614,7 +614,7 @@ void WorkingHours::setupContent(
.lottieSize = st::settingsCloudPasswordIconSize,
.lottieMargins = st::peerAppearanceIconPadding,
.showFinished = showFinishes(),
.about = tr::lng_hours_about(Ui::Text::WithEntities),
.about = tr::lng_hours_about(tr::marked),
.aboutMargins = st::peerAppearanceCoverLabelMargin,
});

View File

@@ -195,7 +195,7 @@ void AddBusinessSummary(
const auto label = content->add(
object_ptr<Ui::FlatLabel>(
content,
std::move(entry.title) | Ui::Text::ToBold(),
std::move(entry.title) | rpl::map(tr::bold),
stLabel),
titlePadding);
label->setAttribute(Qt::WA_TransparentForMouseEvents);
@@ -578,12 +578,12 @@ void Business::setupContent() {
lt_emoji,
rpl::single(Ui::Text::IconEmoji(
&st::textMoreIconEmoji)),
Ui::Text::RichLangValue),
tr::rich),
tr::lng_business_about_sponsored_url()
) | rpl::map([](TextWithEntities text, QString url) {
return Ui::Text::Link(text, url);
return tr::link(text, url);
}),
Ui::Text::RichLangValue),
tr::rich),
st::boxDividerLabel),
st::defaultBoxDividerLabelPadding));
}
@@ -629,9 +629,8 @@ base::weak_qptr<Ui::RpWidget> Business::createPinnedToTop(
auto about = [&]() -> rpl::producer<TextWithEntities> {
return rpl::conditional(
Data::AmPremiumValue(&_controller->session()),
tr::lng_business_unlocked(),
tr::lng_business_about()
) | Ui::Text::ToWithEntities();
tr::lng_business_unlocked(tr::marked),
tr::lng_business_about(tr::marked));
}();
const auto content = [&]() -> Ui::Premium::TopBarAbstract* {

View File

@@ -505,11 +505,11 @@ void Credits::setupContent() {
rpl::single(TextWithEntities()),
isCurrency
? tr::lng_credits_currency_summary_in_button(
Ui::Text::WithEntities)
tr::marked)
: tr::lng_credits_topup_button(
lt_emoji,
rpl::single(Ui::Text::SingleCustomEmoji(u"+"_q)),
Ui::Text::WithEntities)));
tr::marked)));
button->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
const auto show = _controller->uiShow();
if (isCurrency) {
@@ -562,8 +562,8 @@ void Credits::setupContent() {
: _controller->session().credits().balanceValue()
) | rpl::map(
Lang::FormatCreditsAmountDecimal
) | rpl::map(Ui::Text::Bold),
Ui::Text::WithEntities),
) | rpl::map(tr::bold),
tr::marked),
textSt,
st::defaultPopupMenu,
std::move(context)),

View File

@@ -139,8 +139,8 @@ const auto kTopUpPrefix = "cloud_lng_topup_purpose_";
const auto phrase = Lang::GetNonDefaultValue(
kTopUpPrefix + purpose.toUtf8());
return phrase.isEmpty()
? tr::lng_credits_small_balance_fallback(Ui::Text::RichLangValue)
: rpl::single(Ui::Text::RichLangValue(phrase));
? tr::lng_credits_small_balance_fallback(tr::rich)
: rpl::single(tr::rich(phrase));
}
class Balance final
@@ -229,8 +229,8 @@ void ConfirmConvertStarGift(
tr::lng_gift_convert_sure_limit(
lt_count,
rpl::single(daysLeft * 1.),
Ui::Text::RichLangValue),
tr::lng_gift_convert_sure_caution(Ui::Text::RichLangValue)
tr::rich),
tr::lng_gift_convert_sure_caution(tr::rich)
) | rpl::map([](
TextWithEntities &&a,
TextWithEntities &&b,
@@ -267,7 +267,7 @@ void ConvertStarGift(
tr::now,
lt_count,
stars,
Ui::Text::RichLangValue));
tr::rich));
done(true);
}).fail([=](const MTP::Error &error) {
show->showToast(error.type());
@@ -677,9 +677,9 @@ void FillCreditOptions(
tr::lng_credits_summary_options_about_link(),
tr::lng_credits_summary_options_about_url()
) | rpl::map([](const QString &text, const QString &url) {
return Ui::Text::Link(text, url);
return tr::link(text, url);
}),
Ui::Text::RichLangValue);
tr::rich);
Ui::AddSkip(content);
Ui::AddDividerText(
content,
@@ -729,9 +729,8 @@ void FillCreditOptions(
tr::lng_credits_box_out_about(
lt_link,
tr::lng_payments_terms_link(
) | Ui::Text::ToLink(
tr::lng_credits_box_out_about_link(tr::now)),
Ui::Text::WithEntities),
tr::url(tr::lng_credits_box_out_about_link(tr::now))),
tr::marked),
st::creditsBoxAboutDivider);
}
@@ -1260,8 +1259,8 @@ Fn<void(Fn<void()> removed)> UniqueGiftRemoveDetailsHandler(
show->showToast(tr::lng_gift_unique_info_removed(
tr::now,
lt_name,
Ui::Text::Bold(name),
Ui::Text::WithEntities));
tr::bold(name),
tr::marked));
unique->originalDetails = Data::UniqueGiftOriginalDetails();
}
};
@@ -1619,8 +1618,8 @@ void GenericCreditsEntryBody(
content,
tr::lng_credits_box_history_entry_gift_released(
lt_name,
rpl::single(Ui::Text::Link('@' + peer->username())),
Ui::Text::WithEntities),
rpl::single(tr::link('@' + peer->username())),
tr::marked),
st::creditsReleasedByLabel),
style::al_top);
released->setClickHandlerFilter([=](const auto &...) {
@@ -1665,7 +1664,7 @@ void GenericCreditsEntryBody(
starEmoji,
lt_cost,
{ QString::number(s.subscription.credits) },
Ui::Text::WithEntities),
tr::marked),
kMarkupTextOptions,
helper.context([=] { amount->update(); }));
} else if (e.credits.stars()) {
@@ -1796,20 +1795,20 @@ void GenericCreditsEntryBody(
box,
(e.giftRefunded
? tr::lng_action_gift_refunded(
Ui::Text::RichLangValue)
tr::rich)
: e.starsUpgradedBySender
? tr::lng_action_gift_got_upgradable_text(
Ui::Text::RichLangValue)
tr::rich)
: (e.starsToUpgrade
&& giftToSelf
&& !e.giftTransferred)
? tr::lng_action_gift_self_about_unique(
Ui::Text::WithEntities)
tr::marked)
: (e.starsToUpgrade
&& giftToChannelCanManage
&& !e.giftTransferred)
? tr::lng_action_gift_channel_about_unique(
Ui::Text::WithEntities)
tr::marked)
: ((canConvert || e.converted)
? rpl::combine(
(canConvert
@@ -1823,13 +1822,13 @@ void GenericCreditsEntryBody(
: tr::lng_gift_got_stars))(
lt_count,
rpl::single(e.starsConverted * 1.),
Ui::Text::RichLangValue),
tr::rich),
tr::lng_paid_about_link()
) | rpl::map([](
TextWithEntities text,
QString link) {
return text.append(' ').append(
Ui::Text::Link(link));
tr::link(link));
})
: (e.savedToProfile
? (giftToChannel
@@ -1838,7 +1837,7 @@ void GenericCreditsEntryBody(
: (giftToChannel
? tr::lng_action_gift_got_gift_channel
: tr::lng_action_gift_got_gift_text))(
Ui::Text::WithEntities))),
tr::marked))),
st::creditsBoxAbout),
style::al_top);
about->setClickHandlerFilter([=](const auto &...) {
@@ -1856,9 +1855,9 @@ void GenericCreditsEntryBody(
auto link = tr::lng_credits_box_history_entry_gift_about_link(
lt_emoji,
rpl::single(arrow),
Ui::Text::RichLangValue
tr::rich
) | rpl::map([](TextWithEntities text) {
return Ui::Text::Link(
return tr::link(
std::move(text),
u"internal:stars_examples"_q);
});
@@ -1871,11 +1870,11 @@ void GenericCreditsEntryBody(
rpl::single(TextWithEntities{ peer->shortName() }),
lt_link,
std::move(link),
Ui::Text::RichLangValue)
tr::rich)
: tr::lng_credits_box_history_entry_gift_in_about(
lt_link,
std::move(link),
Ui::Text::RichLangValue),
tr::rich),
st::creditsBoxAbout),
style::al_top);
} else if (e.paidMessagesCommission && e.barePeerId) {
@@ -1883,9 +1882,9 @@ void GenericCreditsEntryBody(
auto link = tr::lng_credits_paid_messages_fee_about_link(
lt_emoji,
rpl::single(arrow),
Ui::Text::RichLangValue
tr::rich
) | rpl::map([id = e.barePeerId](TextWithEntities text) {
return Ui::Text::Link(
return tr::link(
std::move(text),
u"internal:edit_paid_messages_fee/"_q + QString::number(id));
});
@@ -1896,10 +1895,10 @@ void GenericCreditsEntryBody(
tr::lng_credits_paid_messages_fee_about(
lt_percent,
rpl::single(
Ui::Text::Bold(QString::number(percent) + '%')),
tr::bold(QString::number(percent) + '%')),
lt_link,
std::move(link),
Ui::Text::RichLangValue),
tr::rich),
st::creditsBoxAbout),
style::al_top);
}
@@ -1924,9 +1923,8 @@ void GenericCreditsEntryBody(
tr::lng_gift_in_blockchain_link_arrow(
lt_arrow,
rpl::single(arrow),
Ui::Text::WithEntities
) | Ui::Text::ToLink(),
Ui::Text::WithEntities),
tr::link),
tr::marked),
st::creditsBoxAboutDivider),
style::al_top);
label->setClickHandlerFilter([=](const auto &...) {
@@ -2031,14 +2029,14 @@ void GenericCreditsEntryBody(
lt_count,
rpl::single(stars * 1.),
lt_channel,
rpl::single(Ui::Text::Bold(giftChannel->name())),
Ui::Text::RichLangValue)
rpl::single(tr::bold(giftChannel->name())),
tr::rich)
: tr::lng_gift_convert_sure_confirm(
lt_count,
rpl::single(stars * 1.),
lt_user,
rpl::single(Ui::Text::Bold(starGiftSender->shortName())),
Ui::Text::RichLangValue);
rpl::single(tr::bold(starGiftSender->shortName())),
tr::rich);
ConfirmConvertStarGift(show, std::move(text), stars, days, [=] {
if (state->convertButtonBusy.current()
|| state->confirmButtonBusy.current()) {
@@ -2102,30 +2100,30 @@ void GenericCreditsEntryBody(
tr::lng_gift_visible_show_arrow(
lt_arrow,
rpl::single(arrow),
Ui::Text::WithEntities)
tr::marked)
) | rpl::map([=](QString &&hint, const TextWithEntities &hide) {
return TextWithEntities{ std::move(hint) }.append(' ').append(
Ui::Text::Link(hide));
tr::link(hide));
});
auto withHide = rpl::combine(
visiblePhrase(),
tr::lng_gift_visible_hide_arrow(
lt_arrow,
rpl::single(arrow),
Ui::Text::WithEntities)
tr::marked)
) | rpl::map([](QString &&hint, const TextWithEntities &hide) {
return TextWithEntities{ std::move(hint) }.append(' ').append(
Ui::Text::Link(hide));
tr::link(hide));
});
auto text = (!e.savedToProfile
&& canToggle
&& (canUpgrade || showNextToUpgrade))
? std::move(withShow)
: !e.savedToProfile
? hiddenPhrase(Ui::Text::WithEntities)
? hiddenPhrase(tr::marked)
: canToggle
? std::move(withHide)
: visiblePhrase(Ui::Text::WithEntities);
: visiblePhrase(tr::marked);
if (e.anonymous && e.barePeerId && !uniqueGift) {
text = rpl::combine(
std::move(text),
@@ -2190,7 +2188,7 @@ void GenericCreditsEntryBody(
return true;
});
label->setMarkedText(
Ui::Text::Link(
tr::link(
tr::lng_credits_subscription_on_button(tr::now),
u"internal:"_q));
} else if (s.cancelled || s.cancelledByBot) {
@@ -2326,14 +2324,14 @@ void GenericCreditsEntryBody(
tr::lng_gift_buy_resale_button(
lt_cost,
rpl::single(Data::FormatGiftResaleTon(*uniqueGift)),
Ui::Text::WithEntities),
tr::marked),
tr::lng_gift_buy_resale_equals(
lt_cost,
rpl::single(Ui::Text::IconEmoji(
&st::starIconEmojiSmall
).append(Lang::FormatCountDecimal(
uniqueGift->starsForResale))),
Ui::Text::WithEntities),
tr::marked),
st::resaleButtonTitle,
st::resaleButtonSubtitle);
} else {
@@ -2341,7 +2339,7 @@ void GenericCreditsEntryBody(
lt_cost,
rpl::single(Ui::Text::IconEmoji(&st::starIconEmoji).append(
Lang::FormatCountDecimal(uniqueGift->starsForResale))),
Ui::Text::WithEntities));
tr::marked));
}
} else if (showNextToUpgrade) {
const auto session = &show->session();
@@ -2502,18 +2500,18 @@ void UniqueGiftValueBox(
(showLastPrice
? tr::lng_gift_value_about_last(
lt_gift,
rpl::single(Ui::Text::Bold(
rpl::single(tr::bold(
Data::UniqueGiftName(*unique))),
lt_platform,
(value->lastSaleFragment
? tr::lng_gift_value_fragment
: tr::lng_gift_value_telegram)(
Ui::Text::WithEntities),
Ui::Text::RichLangValue)
tr::marked),
tr::rich)
: tr::lng_gift_value_about_average(
lt_gift,
rpl::single(Ui::Text::Bold(unique->title)),
Ui::Text::RichLangValue)),
rpl::single(tr::bold(unique->title)),
tr::rich)),
st::uniqueGiftValueAbout)
)->setTryMakeSimilarLines(true);
@@ -2534,7 +2532,7 @@ void UniqueGiftValueBox(
lt_emoji,
rpl::single(Data::SingleCustomEmoji(document)),
lt_platform,
platform(Ui::Text::WithEntities),
platform(tr::marked),
lt_arrow,
rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)),
tr::link),
@@ -3051,51 +3049,51 @@ void SmallBalanceBox(
.about = (v::is<SmallBalanceSubscription>(source)
? tr::lng_credits_small_balance_subscribe(
lt_channel,
rpl::single(Ui::Text::Bold(name)),
Ui::Text::RichLangValue)
rpl::single(tr::bold(name)),
tr::rich)
: v::is<SmallBalanceReaction>(source)
? tr::lng_credits_small_balance_reaction(
lt_channel,
rpl::single(Ui::Text::Bold(name)),
Ui::Text::RichLangValue)
rpl::single(tr::bold(name)),
tr::rich)
: v::is<SmallBalanceVideoStream>(source)
? tr::lng_credits_small_balance_video_stream(
lt_name,
rpl::single(Ui::Text::Bold(name)),
Ui::Text::RichLangValue)
rpl::single(tr::bold(name)),
tr::rich)
: v::is<SmallBalanceDeepLink>(source)
? DeepLinkBalanceAbout(
v::get<SmallBalanceDeepLink>(source).purpose)
: v::is<SmallBalanceStarGift>(source)
? tr::lng_credits_small_balance_star_gift(
lt_user,
rpl::single(Ui::Text::Bold(name)),
Ui::Text::RichLangValue)
rpl::single(tr::bold(name)),
tr::rich)
: v::is<SmallBalanceForMessage>(source)
? (name.isEmpty()
? tr::lng_credits_small_balance_for_messages(
Ui::Text::RichLangValue)
tr::rich)
: tr::lng_credits_small_balance_for_message(
lt_user,
rpl::single(Ui::Text::Bold(name)),
Ui::Text::RichLangValue))
rpl::single(tr::bold(name)),
tr::rich))
: v::is<SmallBalanceForSuggest>(source)
? tr::lng_credits_small_balance_for_suggest(
lt_channel,
rpl::single(Ui::Text::Bold(name)),
Ui::Text::RichLangValue)
rpl::single(tr::bold(name)),
tr::rich)
: v::is<SmallBalanceForOffer>(source)
? tr::lng_credits_small_balance_for_offer(tr::rich)
: v::is<SmallBalanceForSearch>(source)
? tr::lng_credits_small_balance_for_search(
Ui::Text::RichLangValue)
tr::rich)
: name.isEmpty()
? tr::lng_credits_small_balance_fallback(
Ui::Text::RichLangValue)
tr::rich)
: tr::lng_credits_small_balance_about(
lt_bot,
rpl::single(TextWithEntities{ name }),
Ui::Text::RichLangValue)),
tr::rich)),
.light = true,
.gradientStops = Ui::Premium::CreditsIconGradientStops(),
}));
@@ -3345,7 +3343,7 @@ void AddWithdrawalWidget(
amount,
lt_emoji,
Ui::Text::IconEmoji(&st::starIconEmojiLarge),
Ui::Text::RichLangValue));
tr::rich));
}
};
QObject::connect(input, &Ui::MaskedInputField::changed, process);
@@ -3461,13 +3459,13 @@ void AddWithdrawalWidget(
auto text = tr::lng_bot_earn_credits_out_minimal(
tr::now,
lt_link,
Ui::Text::Link(
tr::link(
tr::lng_bot_earn_credits_out_minimal_link(
tr::now,
lt_count,
min),
u"internal:"_q),
Ui::Text::RichLangValue);
tr::rich);
show->showToast(Ui::Toast::Config{
.text = std::move(text),
.filter = [=](const auto ...) {
@@ -3497,13 +3495,13 @@ void AddWithdrawalWidget(
tr::lng_channel_earn_about_link(
lt_emoji,
rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)),
Ui::Text::RichLangValue
tr::rich
) | rpl::map([](TextWithEntities text) {
return Ui::Text::Link(
return tr::link(
std::move(text),
tr::lng_bot_earn_balance_about_url(tr::now));
}),
Ui::Text::RichLangValue),
tr::rich),
st::boxDividerLabel);
Ui::AddSkip(container);
container->add(object_ptr<Ui::DividerLabel>(

View File

@@ -954,13 +954,13 @@ void SetupTagContent(
content,
rpl::conditional(
rpl::duplicate(premium),
tr::lng_filters_enable_tags_about(Ui::Text::RichLangValue),
tr::lng_filters_enable_tags_about(tr::rich),
tr::lng_filters_enable_tags_about_premium(
lt_link,
tr::lng_effect_premium_link() | rpl::map([](QString t) {
return Ui::Text::Link(std::move(t), u"internal:"_q);
return tr::link(std::move(t), u"internal:"_q);
}),
Ui::Text::RichLangValue)));
tr::rich)));
about->setClickHandlerFilter([=](const auto &...) {
Settings::ShowPremium(controller, u"folder_tags"_q);
return true;

View File

@@ -247,7 +247,7 @@ void GlobalTTL::showSure(TimeId ttl, bool rebuild) const {
tr::now,
lt_after_duration,
{ .text = ttlText },
Ui::Text::WithEntities));
tr::marked));
_show->hideLayer(); // Don't use close().
});
request(ttl);
@@ -371,8 +371,8 @@ void GlobalTTL::setupContent() {
tr::lng_settings_ttl_after_about(
lt_link,
tr::lng_settings_ttl_after_about_link(
) | rpl::map([](QString s) { return Ui::Text::Link(s, 1); }),
Ui::Text::WithEntities),
) | rpl::map([](QString s) { return tr::link(s, 1); }),
tr::marked),
st::boxDividerLabel);
footer->setLink(1, std::make_shared<LambdaClickHandler>([=] {
const auto session = &_controller->session();
@@ -401,12 +401,12 @@ void GlobalTTL::setupContent() {
peers.size(),
lt_duration,
{ .text = Ui::FormatTTL(ttl) },
Ui::Text::WithEntities)
tr::marked)
: tr::lng_settings_ttl_select_chats_disabled_toast(
tr::now,
lt_count,
peers.size(),
Ui::Text::WithEntities));
tr::marked));
box->closeBox();
}));
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });

View File

@@ -225,8 +225,8 @@ private:
const auto push = [=] {
const auto now = base::unixtime::now();
consumer.put_next(Data::OnlineTextActive(user, now)
? Ui::Text::Link(Data::OnlineText(user, now))
: Ui::Text::WithEntities(Data::OnlineText(user, now)));
? tr::link(Data::OnlineText(user, now))
: tr::marked(Data::OnlineText(user, now)));
timer->callOnce(Data::OnlineChangeTimeout(user, now));
};
timer->setCallback(push);
@@ -406,13 +406,13 @@ void SetupBirthday(
tr::lng_settings_birthday_contacts(
lt_link,
tr::lng_settings_birthday_contacts_link(
) | Ui::Text::ToLink(u"internal:edit_privacy_birthday"_q),
Ui::Text::WithEntities),
tr::url(u"internal:edit_privacy_birthday"_q)),
tr::marked),
tr::lng_settings_birthday_about(
lt_link,
tr::lng_settings_birthday_about_link(
) | Ui::Text::ToLink(u"internal:edit_privacy_birthday"_q),
Ui::Text::WithEntities)));
tr::url(u"internal:edit_privacy_birthday"_q)),
tr::marked)));
}
void SetupPersonalChannel(
@@ -469,7 +469,7 @@ void SetupRows(
AddRow(
container,
tr::lng_settings_name_label(),
Info::Profile::NameValue(self) | Ui::Text::ToWithEntities(),
Info::Profile::NameValue(self) | rpl::map(tr::marked),
tr::lng_profile_copy_fullname(tr::now),
showEditName,
{ &st::menuIconProfile });

View File

@@ -232,7 +232,7 @@ void Cover::initViewers() {
Info::Profile::UsernameValue(
_user
) | rpl::on_next([=](const TextWithEntities &value) {
_username->setMarkedText(Ui::Text::Link(value.text.isEmpty()
_username->setMarkedText(tr::link(value.text.isEmpty()
? tr::lng_settings_username_add(tr::now)
: value.text));
refreshUsernameGeometry(width());
@@ -437,11 +437,10 @@ void SetupValidatePhoneNumberSuggestion(
content,
tr::lng_settings_suggestion_phone_number_about(
lt_link,
tr::lng_collectible_learn_more(
) | Ui::Text::ToLink(
tr::lng_collectible_learn_more(tr::url(
tr::lng_settings_suggestion_phone_number_about_link(
tr::now)),
Ui::Text::WithEntities),
tr::now))),
tr::marked),
st::boxLabel),
st::boxRowPadding);
label->setClickHandlerFilter([=, weak = base::make_weak(controller)](
@@ -502,7 +501,7 @@ void SetupValidatePhoneNumberSuggestion(
tr::lng_settings_suggestion_phone_number_change(
lt_emoji,
rpl::single(Ui::Text::SingleCustomEmoji(u"@"_q)),
Ui::Text::WithEntities),
tr::marked),
st::boxLabel,
st::defaultPopupMenu,
Ui::Text::MarkedContext{

View File

@@ -282,7 +282,7 @@ void AddTypeButton(
.text = phrase(
lt_count,
rpl::single(float64(count)),
Ui::Text::RichLangValue),
tr::rich),
.confirmed = [=](auto close) { toggle(); close(); },
.confirmText = tr::lng_box_ok(),
.title = tr::lng_notification_exceptions_title(),

View File

@@ -395,11 +395,11 @@ void Passkeys::setupContent(
tr::lng_channel_earn_about_link(
lt_emoji,
rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)),
Ui::Text::RichLangValue
tr::rich
) | rpl::map([](TextWithEntities text) {
return Ui::Text::Link(std::move(text), u"internal"_q);
return tr::link(std::move(text), u"internal"_q);
}),
Ui::Text::RichLangValue
tr::rich
));
label->setClickHandlerFilter([=](const auto &...) {
controller->show(Box(PasskeysNoneBox, session));

View File

@@ -863,7 +863,7 @@ void TopBarWithSticker::updateTitle(
tr::now,
lt_user,
std::move(name),
Ui::Text::WithEntities));
tr::marked));
}
const auto stickerInfo = document->sticker();
if (!stickerInfo) {
@@ -886,21 +886,21 @@ void TopBarWithSticker::updateTitle(
set->thumbnailDocumentId);
const auto entities = EntitiesInText{
{ EntityType::CustomEmoji, 0, 1, entityEmojiData },
Ui::Text::Link(text, linkIndex).entities.front(),
tr::link(text, linkIndex).entities.front(),
};
auto title = (setId == coloredId)
? tr::lng_premium_emoji_status_title_colored(
tr::now,
lt_user,
std::move(name),
Ui::Text::WithEntities)
tr::marked)
: tr::lng_premium_emoji_status_title(
tr::now,
lt_user,
std::move(name),
lt_link,
{ .text = text, .entities = entities, },
Ui::Text::WithEntities);
tr::marked);
_title->setMarkedText(
std::move(title),
Core::TextContext({ .session = &controller->session() }));
@@ -929,7 +929,7 @@ void TopBarWithSticker::updateAbout(
? tr::lng_premium_emoji_status_about
: tr::lng_premium_summary_user_about)(
tr::now,
Ui::Text::RichLangValue));
tr::rich));
}
void TopBarWithSticker::setPaused(bool paused) {
@@ -1154,14 +1154,13 @@ void Premium::setupContent() {
content->add(
object_ptr<Ui::FlatLabel>(
content,
tr::lng_premium_summary_bottom_subtitle(
) | Ui::Text::ToBold(),
tr::lng_premium_summary_bottom_subtitle(tr::bold),
stLabel),
st::defaultSubsectionTitlePadding);
content->add(
object_ptr<Ui::FlatLabel>(
content,
tr::lng_premium_summary_bottom_about(Ui::Text::RichLangValue),
tr::lng_premium_summary_bottom_about(tr::rich),
st::aboutLabel),
st::boxRowPadding);
Ui::AddSkip(
@@ -1197,14 +1196,14 @@ base::weak_qptr<Ui::RpWidget> Premium::createPinnedToTop(
lt_count,
rpl::single(float64(months ? months : gift.days)),
lt_user,
rpl::single(Ui::Text::Bold(peer->name())),
Ui::Text::RichLangValue);
rpl::single(tr::bold(peer->name())),
tr::rich);
}
}
return rpl::conditional(
Data::AmPremiumValue(&_controller->session()),
_controller->session().api().premium().statusTextValue(),
tr::lng_premium_summary_top_about(Ui::Text::RichLangValue));
tr::lng_premium_summary_top_about(tr::rich));
}();
const auto emojiStatusData = Ref::EmojiStatus::Parse(_ref);
@@ -1246,7 +1245,7 @@ base::weak_qptr<Ui::RpWidget> Premium::createPinnedToTop(
.aboutValue = tr::lng_gift_premium_text(
lt_count,
rpl::single(premiumGiftData.perUserTotal * 1.),
Ui::Text::RichLangValue),
tr::rich),
.type = TopBarWithStickerType::PremiumGift,
},
_showFinished.events());
@@ -1841,7 +1840,7 @@ void AddSummaryPremium(
const auto label = content->add(
object_ptr<Ui::FlatLabel>(
content,
std::move(entry.title) | Ui::Text::ToBold(),
std::move(entry.title) | rpl::map(tr::bold),
stLabel),
titlePadding);
label->setAttribute(Qt::WA_TransparentForMouseEvents);

View File

@@ -509,7 +509,7 @@ auto PhoneNumberPrivacyController::warning() const
) | rpl::map([=](bool onlyContactsSee) {
return onlyContactsSee
? tr::lng_edit_privacy_phone_number_contacts(
Ui::Text::WithEntities)
tr::marked)
: rpl::combine(
tr::lng_edit_privacy_phone_number_warning(),
tr::lng_username_link()
@@ -518,7 +518,7 @@ auto PhoneNumberPrivacyController::warning() const
warning + "\n\n" + added + "\n",
};
const auto link = PublicLinkByPhone(self);
return base.append(Ui::Text::Link(link, link));
return base.append(tr::link(link, link));
});
}) | rpl::flatten_latest();
}
@@ -642,7 +642,7 @@ rpl::producer<QString> LastSeenPrivacyController::optionsTitleKey() const {
auto LastSeenPrivacyController::warning() const
-> rpl::producer<TextWithEntities> {
return tr::lng_edit_privacy_lastseen_warning(Ui::Text::WithEntities);
return tr::lng_edit_privacy_lastseen_warning(tr::marked);
}
rpl::producer<QString> LastSeenPrivacyController::exceptionButtonTextKey(
@@ -909,7 +909,7 @@ QString CallsPeer2PeerPrivacyController::optionLabel(
auto CallsPeer2PeerPrivacyController::warning() const
-> rpl::producer<TextWithEntities> {
return tr::lng_settings_peer_to_peer_about(Ui::Text::WithEntities);
return tr::lng_settings_peer_to_peer_about(tr::marked);
}
auto CallsPeer2PeerPrivacyController::exceptionButtonTextKey(
@@ -968,7 +968,7 @@ rpl::producer<QString> ForwardsPrivacyController::optionsTitleKey() const {
auto ForwardsPrivacyController::warning() const
-> rpl::producer<TextWithEntities> {
return tr::lng_edit_privacy_forwards_warning(Ui::Text::WithEntities);
return tr::lng_edit_privacy_forwards_warning(tr::marked);
}
rpl::producer<QString> ForwardsPrivacyController::exceptionButtonTextKey(
@@ -1446,15 +1446,15 @@ Fn<void()> VoicesPrivacyController::premiumClickedCallback(
return nullptr;
}
const auto showToast = [=] {
auto link = Ui::Text::Link(
Ui::Text::Semibold(
auto link = tr::link(
tr::semibold(
tr::lng_settings_privacy_premium_link(tr::now)));
_toastInstance = controller->showToast({
.text = tr::lng_settings_privacy_premium(
tr::now,
lt_link,
link,
Ui::Text::WithEntities),
tr::marked),
.filter = crl::guard(&controller->session(), [=](
const ClickHandlerPtr &,
Qt::MouseButton button) {
@@ -1569,8 +1569,8 @@ object_ptr<Ui::RpWidget> BirthdayPrivacyController::setupAboveWidget(
tr::lng_edit_privacy_birthday_yet(
lt_link,
tr::lng_edit_privacy_birthday_yet_link(
) | Ui::Text::ToLink("internal:edit_birthday"),
Ui::Text::WithEntities),
tr::url(u"internal:edit_birthday"_q)),
tr::marked),
st::boxDividerLabel),
st::defaultBoxDividerLabelPadding));
result->toggleOn(session->changes().peerFlagsValue(
@@ -1648,15 +1648,15 @@ void GiftsAutoSavePrivacyController::ensureAdditionalState(
_state->disallowed = globalPrivacy->disallowedGiftTypesCurrent();
_state->promo = [=] {
_state->disables.fire({});
const auto link = Ui::Text::Bold(
const auto link = tr::bold(
tr::lng_settings_generic_subscribe_link(tr::now));
Settings::ShowPremiumPromoToast(
controller->uiShow(),
tr::lng_settings_generic_subscribe(
tr::now,
lt_link,
Ui::Text::Link(link),
Ui::Text::WithEntities),
tr::link(link),
tr::marked),
u"gifts_privacy"_q);
};
_state->save = [=] {
@@ -1713,7 +1713,7 @@ object_ptr<Ui::RpWidget> GiftsAutoSavePrivacyController::setupAboveWidget(
tr::lng_edit_privacy_gifts_show_icon_about(
lt_emoji,
rpl::single(Ui::Text::IconEmoji(&st::settingsGiftIconEmoji)),
Ui::Text::WithEntities));
tr::marked));
return result;
}

View File

@@ -311,15 +311,15 @@ void AddPremiumPrivacyButton(
}
const auto showToast = [=] {
auto link = Ui::Text::Link(
Ui::Text::Semibold(
auto link = tr::link(
tr::semibold(
tr::lng_settings_privacy_premium_link(tr::now)));
(*toast) = controller->showToast({
.text = tr::lng_settings_privacy_premium(
tr::now,
lt_link,
link,
Ui::Text::WithEntities),
tr::marked),
.duration = Ui::Toast::kDefaultDuration * 2,
.filter = crl::guard(&controller->session(), [=](
const ClickHandlerPtr &,

View File

@@ -244,7 +244,7 @@ struct Labeled {
- st.style.font->width(button)
- st::settingsButtonRightSkip;
keys->setMarkedText((recording == raw)
? Ui::Text::Italic(
? tr::italic(
tr::lng_shortcuts_recording(tr::now))
: key.isEmpty()
? TextWithEntities()