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

@@ -234,16 +234,16 @@ QString FormatProgramDuration(int durationMonths) {
rpl::producer<TextWithEntities> FormatForProgramDuration(
int durationMonths) {
return !durationMonths
? tr::lng_star_ref_one_about_for_forever(Ui::Text::RichLangValue)
? tr::lng_star_ref_one_about_for_forever(tr::rich)
: (durationMonths < 12)
? tr::lng_star_ref_one_about_for_months(
lt_count,
rpl::single(durationMonths * 1.),
Ui::Text::RichLangValue)
tr::rich)
: tr::lng_star_ref_one_about_for_years(
lt_count,
rpl::single((durationMonths / 12) * 1.),
Ui::Text::RichLangValue);
tr::rich);
}
not_null<Ui::AbstractButton*> AddViewListButton(
@@ -264,7 +264,7 @@ not_null<Ui::AbstractButton*> AddViewListButton(
const auto label = parent->add(
object_ptr<Ui::FlatLabel>(
parent,
std::move(title) | Ui::Text::ToBold(),
std::move(title) | rpl::map(tr::bold),
stLabel),
titlePadding);
label->setAttribute(Qt::WA_TransparentForMouseEvents);
@@ -457,13 +457,13 @@ object_ptr<Ui::BoxContent> StarRefLinkBox(
? tr::lng_star_ref_link_about_user
: tr::lng_star_ref_link_about_channel)(
lt_amount,
rpl::single(Ui::Text::Bold(
rpl::single(tr::bold(
FormatCommission(program.commission))),
lt_app,
rpl::single(Ui::Text::Bold(bot->name())),
rpl::single(tr::bold(bot->name())),
lt_duration,
FormatForProgramDuration(program.durationMonths),
Ui::Text::WithEntities),
tr::marked),
st::starrefCenteredText),
style::al_top);
@@ -509,11 +509,11 @@ object_ptr<Ui::BoxContent> StarRefLinkBox(
rpl::single(row.state.users * 1.),
lt_app,
rpl::single(name),
Ui::Text::WithEntities)
tr::marked)
: tr::lng_star_ref_link_copy_none(
lt_app,
rpl::single(name),
Ui::Text::WithEntities)));
tr::marked)));
});
}
@@ -583,13 +583,13 @@ object_ptr<Ui::BoxContent> JoinStarRefBox(
box,
tr::lng_star_ref_one_about(
lt_app,
rpl::single(Ui::Text::Bold(bot->name())),
rpl::single(tr::bold(bot->name())),
lt_amount,
rpl::single(Ui::Text::Bold(
rpl::single(tr::bold(
FormatCommission(program.commission))),
lt_duration,
FormatForProgramDuration(program.durationMonths),
Ui::Text::WithEntities),
tr::marked),
st::starrefCenteredText),
style::al_top);
@@ -605,7 +605,7 @@ object_ptr<Ui::BoxContent> JoinStarRefBox(
lt_amount,
rpl::single(
Ui::Text::Wrapped(text, EntityType::Bold)),
Ui::Text::WithEntities),
tr::marked),
st::starrefRevenueText,
st::defaultPopupMenu),
st::boxRowPadding,
@@ -722,8 +722,8 @@ object_ptr<Ui::BoxContent> JoinStarRefBox(
tr::lng_star_ref_one_join_text(
lt_terms,
tr::lng_star_ref_button_link(
) | Ui::Text::ToLink(tr::lng_star_ref_tos_url(tr::now)),
Ui::Text::WithEntities));
tr::url(tr::lng_star_ref_tos_url(tr::now))),
tr::marked));
});
}
@@ -735,7 +735,7 @@ object_ptr<Ui::BoxContent> ConfirmEndBox(Fn<void()> finish) {
box->addRow(
object_ptr<Ui::FlatLabel>(
box,
tr::lng_star_ref_warning_if_end(Ui::Text::RichLangValue),
tr::lng_star_ref_warning_if_end(tr::rich),
st::boxLabel),
margins);
const auto addPoint = [&](tr::phrase<> text) {
@@ -744,7 +744,7 @@ object_ptr<Ui::BoxContent> ConfirmEndBox(Fn<void()> finish) {
box,
object_ptr<Ui::FlatLabel>(
box,
text(Ui::Text::RichLangValue),
text(tr::rich),
st::blockUserConfirmation),
QMargins(st::boxTextFont->height, 0, 0, 0)),
margins);
@@ -943,7 +943,7 @@ void ConfirmUpdate(
Ui::ConfirmBox(box, {
.text = (exists
? tr::lng_star_ref_warning_change
: tr::lng_star_ref_warning_text)(Ui::Text::RichLangValue),
: tr::lng_star_ref_warning_text)(tr::rich),
.confirmed = [=](Fn<void()> close) {
if (*sent) {
return;

View File

@@ -645,8 +645,8 @@ base::unique_qptr<Ui::PopupMenu> ListController::rowContextMenu(
_controller->show(Ui::MakeConfirmBox({
.text = tr::lng_star_ref_revoke_text(
lt_bot,
rpl::single(Ui::Text::Bold(bot->name())),
Ui::Text::RichLangValue),
rpl::single(tr::bold(bot->name())),
tr::rich),
.confirmed = sure,
.title = tr::lng_star_ref_revoke_title(),
}));
@@ -771,18 +771,16 @@ not_null<ListController*> InnerWidget::setupMy() {
void InnerWidget::setupSort(not_null<Ui::RpWidget*> label) {
constexpr auto phrase = [](SuggestedSort sort) {
return (sort == SuggestedSort::Profitability)
? tr::lng_star_ref_sort_profitability(tr::now)
return ((sort == SuggestedSort::Profitability)
? tr::lng_star_ref_sort_profitability
: (sort == SuggestedSort::Revenue)
? tr::lng_star_ref_sort_revenue(tr::now)
: tr::lng_star_ref_sort_date(tr::now);
? tr::lng_star_ref_sort_revenue
: tr::lng_star_ref_sort_date)(tr::now, tr::link);
};
const auto sort = Ui::CreateChild<Ui::FlatLabel>(
label->parentWidget(),
tr::lng_star_ref_sort_text(
lt_sort,
_sort.value() | rpl::map(phrase) | Ui::Text::ToLink(),
Ui::Text::WithEntities),
tr::lng_star_ref_sort_text(lt_sort, _sort.value() | rpl::map(phrase),
tr::marked),
st::defaultFlatLabel);
rpl::combine(
label->geometryValue(),
@@ -806,7 +804,7 @@ void InnerWidget::setupSort(not_null<Ui::RpWidget*> label) {
};
for (const auto order : orders) {
const auto chosen = (order == _sort.current());
menu->addAction(phrase(order), crl::guard(this, [=] {
menu->addAction(phrase(order).text, crl::guard(this, [=] {
_sort = order;
}), chosen ? &st::mediaPlayerMenuCheck : nullptr);
}
@@ -867,7 +865,7 @@ object_ptr<Ui::RpWidget> InnerWidget::infoRow(
raw->add(
object_ptr<Ui::FlatLabel>(
raw,
std::move(title) | Ui::Text::ToBold(),
std::move(title) | rpl::map(tr::bold),
st::defaultFlatLabel),
st::settingsPremiumRowTitlePadding);
raw->add(
@@ -989,8 +987,7 @@ void Widget::restoreState(not_null<Memento*> memento) {
std::unique_ptr<Ui::Premium::TopBarAbstract> Widget::setupTop() {
auto title = tr::lng_star_ref_list_title();
auto about = tr::lng_star_ref_list_about_channel()
| Ui::Text::ToWithEntities();
auto about = tr::lng_star_ref_list_about_channel(tr::marked);
const auto controller = this->controller();
const auto weak = base::make_weak(controller->parentController());

View File

@@ -757,7 +757,7 @@ void InnerWidget::setupEnd() {
.title = tr::lng_star_ref_ended_title(tr::now),
.text = tr::lng_star_ref_ended_text(
tr::now,
Ui::Text::RichLangValue),
tr::rich),
.duration = Ui::Toast::kDefaultDuration * 3,
});
}
@@ -778,7 +778,7 @@ object_ptr<Ui::RpWidget> InnerWidget::infoRow(
raw->add(
object_ptr<Ui::FlatLabel>(
raw,
std::move(title) | Ui::Text::ToBold(),
std::move(title) | rpl::map(tr::bold),
st::defaultFlatLabel),
st::settingsPremiumRowTitlePadding);
raw->add(
@@ -902,7 +902,7 @@ void Widget::restoreState(not_null<Memento*> memento) {
std::unique_ptr<Ui::Premium::TopBarAbstract> Widget::setupTop() {
auto title = tr::lng_star_ref_title();
auto about = tr::lng_star_ref_about() | Ui::Text::ToWithEntities();
auto about = tr::lng_star_ref_about(tr::marked);
const auto controller = this->controller();
const auto weak = base::make_weak(controller->parentController());
@@ -1008,8 +1008,8 @@ std::unique_ptr<Ui::RpWidget> Widget::setupBottom() {
: tr::lng_star_ref_start_info)(
lt_terms,
tr::lng_star_ref_button_link(
) | Ui::Text::ToLink(tr::lng_star_ref_tos_url(tr::now)),
Ui::Text::WithEntities),
tr::url(tr::lng_star_ref_tos_url(tr::now))),
tr::marked),
st::boxDividerLabel),
QMargins(margins.left(), 0, margins.right(), 0));
save->setClickedCallback([=] {
@@ -1032,7 +1032,7 @@ std::unique_ptr<Ui::RpWidget> Widget::setupBottom() {
? tr::lng_star_ref_updated_text
: tr::lng_star_ref_created_text)(
tr::now,
Ui::Text::RichLangValue),
tr::rich),
.duration = Ui::Toast::kDefaultDuration * 3,
});
});

View File

@@ -332,7 +332,7 @@ void CreateGiveawayBox(
(peer->isMegagroup()
? tr::lng_giveaway_new_about_group()
: tr::lng_giveaway_new_about())
) | rpl::map(Ui::Text::RichLangValue));
) | rpl::map(tr::rich));
{
const auto &padding = st::giveawayGiftCodeCoverDividerPadding;
Ui::AddSkip(box->verticalLayout(), padding.bottom());
@@ -1023,9 +1023,9 @@ void CreateGiveawayBox(
lt_link,
tr::lng_premium_gift_terms_link(
) | rpl::map([](const QString &t) {
return Ui::Text::Link(t, 1);
return tr::link(t, 1);
}),
Ui::Text::WithEntities),
tr::marked),
st::boxDividerLabel);
terms->setLink(1, std::make_shared<LambdaClickHandler>([=] {
box->closeBox();
@@ -1195,7 +1195,7 @@ void CreateGiveawayBox(
users,
lt_duration,
TextWithEntities{ duration },
Ui::Text::RichLangValue);
tr::rich);
}
return tr::lng_giveaway_prizes_additional(
tr::now,
@@ -1205,7 +1205,7 @@ void CreateGiveawayBox(
TextWithEntities{ prize },
lt_duration,
TextWithEntities{ duration },
Ui::Text::RichLangValue);
tr::rich);
});
auto creditsAdditionalAbout = rpl::combine(
state->additionalPrize.value(),
@@ -1218,7 +1218,7 @@ void CreateGiveawayBox(
tr::now,
lt_count,
credits,
Ui::Text::RichLangValue)
tr::rich)
: tr::lng_giveaway_prizes_additional_credits(
tr::now,
lt_count,
@@ -1230,8 +1230,8 @@ void CreateGiveawayBox(
tr::now,
lt_count,
credits,
Ui::Text::RichLangValue),
Ui::Text::RichLangValue);
tr::rich),
tr::rich);
});
auto creditsValueType = typeGroup->value(
@@ -1247,9 +1247,8 @@ void CreateGiveawayBox(
std::move(additionalAbout)),
rpl::conditional(
rpl::duplicate(creditsValueType),
tr::lng_giveaway_additional_credits_about(),
tr::lng_giveaway_additional_about()
) | Ui::Text::ToWithEntities()));
tr::lng_giveaway_additional_credits_about(tr::marked),
tr::lng_giveaway_additional_about(tr::marked))));
Ui::AddSkip(additionalWrap);
}
@@ -1487,15 +1486,15 @@ void CreateGiveawayBox(
? tr::lng_giveaway_created_body_group
: tr::lng_giveaway_created_body);
show->showToast({
.text = Ui::Text::Bold(
.text = tr::bold(
title(tr::now)).append('\n').append(
body(
tr::now,
lt_link,
Ui::Text::Link(
tr::link(
tr::lng_giveaway_created_link(
tr::now)),
Ui::Text::WithEntities)),
tr::marked)),
.filter = filter,
.adaptive = true,
.duration = kDoneTooltipDuration,

View File

@@ -357,7 +357,7 @@ void InnerWidget::fill() {
const auto empty = container->add(object_ptr<Dialogs::SearchEmpty>(
container,
Dialogs::SearchEmptyIcon::NoResults,
tr::lng_search_tab_no_results(Ui::Text::Bold)));
tr::lng_search_tab_no_results(tr::bold)));
empty->setMinimalHeight(st::normalBoxLottieSize.height());
empty->animate();
return;
@@ -419,11 +419,11 @@ void InnerWidget::fill() {
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), 1);
return tr::link(std::move(text), 1);
}),
Ui::Text::RichLangValue),
tr::rich),
st::boxDividerLabel);
label->setLink(1, std::make_shared<LambdaClickHandler>([=] {
_show->showBox(Box([=](not_null<Ui::GenericBox*> box) {
@@ -542,8 +542,8 @@ void InnerWidget::fill() {
tr::lng_channel_earn_learn_coin_title(
lt_emoji,
rpl::single(
Ui::Text::Link(bigCurrencyIcon, 1)),
Ui::Text::RichLangValue),
tr::link(bigCurrencyIcon, 1)),
tr::rich),
st::boxTitle,
st::defaultPopupMenu,
emojiHelper.context()),
@@ -571,11 +571,11 @@ void InnerWidget::fill() {
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), 1);
return tr::link(std::move(text), 1);
}),
Ui::Text::RichLangValue),
tr::rich),
st::channelEarnLearnDescription));
label->resizeToWidth(box->width()
- rect::m::sum::h(st::boxRowPadding));

View File

@@ -222,7 +222,7 @@ void GiftButton::setDescriptor(const GiftDescriptor &descriptor, Mode mode) {
_text = Ui::Text::String(st::giftBoxGiftHeight / 4);
_text.setMarkedText(
st::defaultTextStyle,
Ui::Text::Bold(
tr::bold(
tr::lng_months(tr::now, lt_count, months)
).append('\n').append(
tr::lng_gift_premium_label(tr::now)

View File

@@ -1257,8 +1257,8 @@ void InnerWidget::refreshAbout() {
if (filteredEmpty) {
auto text = tr::lng_peer_gifts_empty_search(
tr::now,
Ui::Text::RichLangValue);
text.append("\n\n").append(Ui::Text::Link(
tr::rich);
text.append("\n\n").append(tr::link(
tr::lng_peer_gifts_view_all(tr::now)));
auto about = std::make_unique<Ui::FlatLabel>(
this,
@@ -1316,13 +1316,13 @@ void InnerWidget::refreshAbout() {
_about = std::make_unique<Ui::FlatLabel>(
this,
((maybeEmpty && !knownEmpty)
? tr::lng_contacts_loading(Ui::Text::WithEntities)
? tr::lng_contacts_loading(tr::marked)
: _peer->isSelf()
? tr::lng_peer_gifts_about_mine(Ui::Text::RichLangValue)
? tr::lng_peer_gifts_about_mine(tr::rich)
: tr::lng_peer_gifts_about(
lt_user,
rpl::single(Ui::Text::Bold(_peer->shortName())),
Ui::Text::RichLangValue)),
rpl::single(tr::bold(_peer->shortName())),
tr::rich)),
st::giftListAbout);
_about->show();
resizeToWidth(width());
@@ -1469,7 +1469,7 @@ void InnerWidget::refreshCollectionsTabs() {
auto tabs = std::vector<Ui::SubTabs::Tab>();
tabs.push_back({
.id = u"all"_q,
.text = tr::lng_gift_collection_all(tr::now, Ui::Text::WithEntities),
.text = tr::lng_gift_collection_all(tr::now, tr::marked),
});
for (const auto &collection : _collections) {
auto &per = _perCollection[collection.id];

View File

@@ -524,7 +524,7 @@ ListController *CreateAnswerRows(
tr::lng_polls_show_more(
lt_count_decimal,
controller->loadMoreCount() | rpl::map(_1 + 0.),
Ui::Text::Upper),
tr::upper),
st::pollResultsShowMore)));
more->entity()->setClickedCallback([=] {
controller->allowLoadMore();

View File

@@ -80,7 +80,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/rect.h"
#include "ui/ui_utility.h"
#include "ui/text/format_values.h"
#include "ui/text/text_utilities.h" // Ui::Text::ToUpper
#include "ui/text/text_variant.h"
#include "ui/toast/toast.h"
#include "ui/vertical_list.h"
@@ -144,7 +143,7 @@ base::options::toggle ShowChannelJoinedBelowAbout({
end(usernames));
for (auto &username : std::move(subrange)) {
const auto isLast = (usernames.back() == username);
result.append(Ui::Text::Link(
result.append(tr::link(
'@' + base::take(username.text),
username.entities.front().data()));
if (!isLast) {
@@ -162,8 +161,8 @@ base::options::toggle ShowChannelJoinedBelowAbout({
UsernamesValue(peer) | rpl::map([](std::vector<TextWithEntities> v) {
return !v.empty();
}),
tr::lng_filters_link_subtitle(Ui::Text::WithEntities),
tr::lng_info_link_topic_label(Ui::Text::WithEntities));
tr::lng_filters_link_subtitle(tr::marked),
tr::lng_info_link_topic_label(tr::marked));
}
[[nodiscard]] Fn<void(QString)> UsernamesLinkCallback(
@@ -238,7 +237,7 @@ base::options::toggle ShowChannelJoinedBelowAbout({
? tr::lng_you_joined_group
: tr::lng_action_you_joined)(
tr::now,
Ui::Text::Italic));
tr::italic));
value.append(Italic(": "));
const auto raw = channel->inviteDate;
value.append(Link(
@@ -874,7 +873,7 @@ void DeleteContactNote(
auto label = BirthdayLabelText(rpl::duplicate(birthday));
auto text = BirthdayValueText(
rpl::duplicate(birthday)
) | Ui::Text::ToWithEntities();
) | rpl::map(tr::marked);
const auto giftIcon = Ui::CreateChild<Ui::RpWidget>(layout);
giftIcon->resize(st::birthdayTodayIcon.size());
@@ -983,7 +982,7 @@ template <typename Text, typename ToggleOn, typename Callback>
const style::SettingsButton &st = st::infoMainButton) {
const auto button = AddActionButton(
parent,
std::move(text) | Ui::Text::ToUpper(),
std::move(text) | rpl::map(tr::upper),
std::move(toggleOn),
std::move(callback),
nullptr,
@@ -1635,7 +1634,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
UsernameValue(user, true) | rpl::map([=](TextWithEntities u) {
return u.text.isEmpty()
? TextWithEntities()
: Ui::Text::Link(u, UsernameUrl(user, u.text.mid(1)));
: tr::link(u, UsernameUrl(user, u.text.mid(1)));
}),
QString(),
st::infoProfileLabeledUsernamePadding);
@@ -1683,7 +1682,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
} else if (!details.location.point) {
return TextWithEntities{ details.location.address };
}
return Ui::Text::Link(
return tr::link(
TextUtilities::SingleLine(details.location.address),
LocationClickHandler::Url(*details.location.point));
});
@@ -1706,7 +1705,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
const auto text = link.text;
return text.isEmpty()
? TextWithEntities()
: Ui::Text::Link(
: tr::link(
(text.startsWith(u"https://"_q)
? text.mid(u"https://"_q.size())
: text) + addToLink,
@@ -1749,7 +1748,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
channel
) | rpl::map([](const ChannelLocation *location) {
return location
? Ui::Text::Link(
? tr::link(
TextUtilities::SingleLine(location->address),
LocationClickHandler::Url(location->point))
: TextWithEntities();
@@ -1794,7 +1793,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupPersonalChannel(
const auto channelLabelFactory = [=](rpl::producer<ChannelData*> c) {
return rpl::combine(
tr::lng_info_personal_channel_label(Ui::Text::WithEntities),
tr::lng_info_personal_channel_label(tr::marked),
std::move(c)
) | rpl::map([](TextWithEntities &&text, ChannelData *channel) {
const auto count = channel ? channel->membersCount() : 0;
@@ -1850,7 +1849,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupPersonalChannel(
) | rpl::map([=](ChannelData *channel) {
return channel ? NameValue(channel) : rpl::single(QString());
}) | rpl::flatten_latest() | rpl::map([](const QString &name) {
return name.isEmpty() ? TextWithEntities() : Ui::Text::Link(name);
return name.isEmpty() ? TextWithEntities() : tr::link(name);
});
auto line = CreateTextWithLabel(
result,
@@ -2111,8 +2110,8 @@ void DetailsFiller::setupMainApp() {
rpl::combine(
tr::lng_profile_open_app_about(
lt_terms,
tr::lng_profile_open_app_terms() | Ui::Text::ToLink(url),
Ui::Text::WithEntities),
tr::lng_profile_open_app_terms(tr::url(url)),
tr::marked),
user->session().changes().peerFlagsValue(
user,
Data::PeerUpdate::Flag::VerifyInfo)
@@ -2389,8 +2388,8 @@ void ActionsFiller::addAffiliateProgram(not_null<UserData*> user) {
lt_bot,
rpl::single(TextWithEntities{ user->name() }),
lt_amount,
rpl::duplicate(commission) | Ui::Text::ToWithEntities(),
Ui::Text::RichLangValue));
rpl::duplicate(commission) | rpl::map(tr::marked),
tr::rich));
Ui::AddSkip(inner);
wrap->toggleOn(std::move(

View File

@@ -22,7 +22,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/fields/input_field.h"
#include "ui/widgets/scroll_area.h"
#include "ui/wrap/padding_wrap.h"
#include "ui/text/text_utilities.h" // Ui::Text::ToUpper
#include "ui/search_field_controller.h"
#include "lang/lang_keys.h"
#include "ui/boxes/confirm_box.h"
@@ -177,8 +176,8 @@ object_ptr<Ui::FlatLabel> Members::setupTitle() {
tr::lng_chat_status_members(
lt_count_decimal,
MembersCountValue(_peer) | tr::to_count(),
Ui::Text::Upper),
tr::lng_channel_admins(Ui::Text::Upper)),
tr::upper),
tr::lng_channel_admins(tr::upper)),
st::infoBlockHeaderLabel);
result->setAttribute(Qt::WA_TransparentForMouseEvents);
return result;

View File

@@ -129,7 +129,7 @@ void AddPhoneMenu(not_null<Ui::PopupMenu*> menu, not_null<UserData*> user) {
return;
} else if (const auto url = AppConfig::FragmentLink(&user->session())) {
menu->addSeparator(&st::expandedMenuSeparator);
const auto link = Ui::Text::Link(
const auto link = tr::link(
tr::lng_info_mobile_context_menu_fragment_about_link(tr::now),
*url);
menu->addAction(base::make_unique_q<TextItem>(
@@ -138,7 +138,7 @@ void AddPhoneMenu(not_null<Ui::PopupMenu*> menu, not_null<UserData*> user) {
tr::lng_info_mobile_context_menu_fragment_about(
lt_link,
rpl::single(link),
Ui::Text::RichLangValue)));
tr::rich)));
}
}

View File

@@ -134,7 +134,7 @@ void StatusLabel::refresh() {
if (!channel->membersCountKnown()) {
auto result = ChannelTypeText(channel);
return hasMembersLink
? Ui::Text::Link(result)
? tr::link(result)
: TextWithEntities{ .text = result };
}
const auto onlineCount = _onlineCount;
@@ -144,7 +144,7 @@ void StatusLabel::refresh() {
onlineCount,
channel->isMegagroup());
return hasMembersLink
? Ui::Text::Link(result)
? tr::link(result)
: TextWithEntities{ .text = result };
}
return tr::lng_chat_status_unaccessible(tr::now, WithEntities);

View File

@@ -1115,8 +1115,8 @@ void TopBar::setupUserpicButton(
.about = (*phrase)(
tr::now,
lt_user,
Ui::Text::Bold(name),
Ui::Text::WithEntities),
tr::bold(name),
tr::marked),
.confirm = ((type == ChosenType::Suggest)
? tr::lng_profile_suggest_button(tr::now)
: tr::lng_profile_set_photo_button(tr::now)),
@@ -1262,8 +1262,8 @@ void TopBar::setupUserpicButton(
const auto text = tr::lng_profile_topic_toast(
tr::now,
lt_name,
Ui::Text::Link(packName, u"internal:"_q),
Ui::Text::WithEntities);
tr::link(packName, u"internal:"_q),
tr::marked);
const auto weak = base::make_weak(controller);
controller->showToast(Ui::Toast::Config{
.text = text,

View File

@@ -130,8 +130,8 @@ rpl::producer<TextWithEntities> PhoneValue(not_null<UserData*> user) {
user,
UpdateFlag::PhoneNumber) | rpl::to_empty
) | rpl::map([=] {
return Ui::FormatPhone(user->phone());
}) | Ui::Text::ToWithEntities();
return tr::marked(Ui::FormatPhone(user->phone()));
});
}
rpl::producer<TextWithEntities> PhoneOrHiddenValue(not_null<UserData*> user) {
@@ -146,9 +146,9 @@ rpl::producer<TextWithEntities> PhoneOrHiddenValue(not_null<UserData*> user) {
const QString &about,
const QString &hidden) {
if (phone.text.isEmpty() && username.isEmpty() && about.isEmpty()) {
return Ui::Text::WithEntities(hidden);
return tr::marked(hidden);
} else if (IsCollectiblePhone(user)) {
return Ui::Text::Link(phone, u"internal:collectible_phone/"_q
return tr::link(phone, u"internal:collectible_phone/"_q
+ user->phone() + '@' + QString::number(user->id.value));
} else {
return phone;
@@ -164,9 +164,9 @@ rpl::producer<TextWithEntities> UsernameValue(
: (PlainUsernameValue(peer) | rpl::type_erased)
) | rpl::map([](QString &&username) {
return username.isEmpty()
? QString()
: ('@' + username);
}) | Ui::Text::ToWithEntities();
? tr::marked()
: tr::marked('@' + username);
});
}
QString UsernameUrl(
@@ -192,7 +192,7 @@ rpl::producer<std::vector<TextWithEntities>> UsernamesValue(
return ranges::views::all(
usernames
) | ranges::views::transform([&](const QString &u) {
return Ui::Text::Link(u, UsernameUrl(peer, u));
return tr::link(u, UsernameUrl(peer, u));
}) | ranges::to_vector;
};
auto value = rpl::merge(

View File

@@ -176,9 +176,9 @@ void MusicInner::refreshEmpty() {
_empty = object_ptr<Ui::FlatLabel>(
this,
(!knownEmpty
? tr::lng_contacts_loading(Ui::Text::WithEntities)
? tr::lng_contacts_loading(tr::marked)
: rpl::single(
tr::lng_media_song_empty(tr::now, Ui::Text::WithEntities))),
tr::lng_media_song_empty(tr::now, tr::marked))),
st::giftListAbout);
_empty->show();
_emptyLoading = !knownEmpty;

View File

@@ -173,8 +173,9 @@ void ListController::setupUnlock() {
rpl::single(upto * 1.),
lt_link,
tr::lng_similar_channels_premium_all_link(
) | Ui::Text::ToBold() | Ui::Text::ToLink(),
Ui::Text::RichLangValue),
tr::bold
) | rpl::map(tr::link),
tr::rich),
st::similarChannelsLockAbout);
about->setClickHandlerFilter([=](const auto &...) {
const auto window = _controller->parentController();

View File

@@ -718,10 +718,10 @@ void InnerWidget::refreshEmpty() {
_empty = object_ptr<Ui::FlatLabel>(
this,
(!knownEmpty
? tr::lng_contacts_loading(Ui::Text::WithEntities)
? tr::lng_contacts_loading(tr::marked)
: _peer->isSelf()
? tr::lng_stories_empty(Ui::Text::RichLangValue)
: tr::lng_stories_empty_channel(Ui::Text::RichLangValue)),
? tr::lng_stories_empty(tr::rich)
: tr::lng_stories_empty_channel(tr::rich)),
st::giftListAbout);
_empty->show();
}
@@ -750,7 +750,7 @@ void InnerWidget::refreshAlbumsTabs() {
.id = u"all"_q,
.text = tr::lng_stories_album_all(
tr::now,
Ui::Text::WithEntities),
tr::marked),
});
for (const auto &album : _albums) {
auto title = TextWithEntities();