Remove all legacy global namespace langs.

This commit is contained in:
John Preston 2019-06-19 18:39:25 +02:00
parent edcd09c29f
commit 4917ca7b32
96 changed files with 638 additions and 407 deletions

View file

@ -551,7 +551,8 @@ void ApiWrap::sendMessageFail(const RPCError &error) {
const auto link = textcmdLink(
Core::App().createInternalLinkFull(qsl("spambot")),
tr::lng_cant_more_info(tr::now));
Ui::show(Box<InformBox>(lng_error_public_groups_denied(
Ui::show(Box<InformBox>(tr::lng_error_public_groups_denied(
tr::now,
lt_more_info,
link)));
}

View file

@ -53,7 +53,7 @@ rpl::producer<TextWithEntities> Text3() {
} // namespace
AboutBox::AboutBox(QWidget *parent)
: _version(this, lng_about_version(lt_version, currentVersionText()), st::aboutVersionLink)
: _version(this, tr::lng_about_version(tr::now, lt_version, currentVersionText()), st::aboutVersionLink)
, _text1(this, Text1(), st::aboutLabel)
, _text2(this, Text2(), st::aboutLabel)
, _text3(this, Text3(), st::aboutLabel) {

View file

@ -69,9 +69,9 @@ QString PeerFloodErrorText(PeerFloodType type) {
Core::App().createInternalLinkFull(qsl("spambot")),
tr::lng_cant_more_info(tr::now));
if (type == PeerFloodType::InviteGroup) {
return lng_cant_invite_not_contact(lt_more_info, link);
return tr::lng_cant_invite_not_contact(tr::now, lt_more_info, link);
}
return lng_cant_send_to_not_contact(lt_more_info, link);
return tr::lng_cant_send_to_not_contact(tr::now, lt_more_info, link);
}
void ShowAddParticipantsError(
@ -245,7 +245,7 @@ void AddContactBox::paintEvent(QPaintEvent *e) {
p.setPen(st::boxTextFg);
p.setFont(st::boxTextFont);
auto textHeight = height() - st::contactPadding.top() - st::contactPadding.bottom() - st::boxPadding.bottom();
p.drawText(QRect(st::boxPadding.left(), st::contactPadding.top(), width() - st::boxPadding.left() - st::boxPadding.right(), textHeight), lng_contact_not_joined(lt_name, _sentName), style::al_topleft);
p.drawText(QRect(st::boxPadding.left(), st::contactPadding.top(), width() - st::boxPadding.left() - st::boxPadding.right(), textHeight), tr::lng_contact_not_joined(tr::now, lt_name, _sentName), style::al_topleft);
} else {
st::contactUserIcon.paint(
p,
@ -1348,8 +1348,15 @@ void RevokePublicLinkBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
auto pressed = base::take(_pressed);
setCursor((_selected || _pressed) ? style::cur_pointer : style::cur_default);
if (pressed && pressed == _selected) {
auto text_method = pressed->isMegagroup() ? lng_channels_too_much_public_revoke_confirm_group : lng_channels_too_much_public_revoke_confirm_channel;
auto text = text_method(lt_link, Core::App().createInternalLink(pressed->userName()), lt_group, pressed->name);
auto text_method = pressed->isMegagroup()
? tr::lng_channels_too_much_public_revoke_confirm_group
: tr::lng_channels_too_much_public_revoke_confirm_channel;
auto text = text_method(
tr::now,
lt_link,
Core::App().createInternalLink(pressed->userName()),
lt_group,
pressed->name);
auto confirmText = tr::lng_channels_too_much_public_revoke(tr::now);
_weakRevokeConfirmBox = Ui::show(Box<ConfirmBox>(text, confirmText, crl::guard(this, [this, pressed]() {
if (_revokeRequestId) return;

View file

@ -102,7 +102,8 @@ void AutoDownloadBox::setupContent() {
limits->events_starting_with_copy(
initialLimit
) | rpl::map([](int value) {
return lng_media_size_up_to(
return tr::lng_media_size_up_to(
tr::now,
lt_size,
QString::number(value / kMegabyte) + " MB");
}),

View file

@ -25,7 +25,7 @@ void AutoLockBox::prepare() {
auto count = int(options.size());
_options.reserve(count);
for (auto seconds : options) {
_options.emplace_back(this, group, seconds, (seconds % 3600) ? lng_passcode_autolock_minutes(lt_count, seconds / 60) : lng_passcode_autolock_hours(lt_count, seconds / 3600), st::autolockButton);
_options.emplace_back(this, group, seconds, (seconds % 3600) ? tr::lng_passcode_autolock_minutes(tr::now, lt_count, seconds / 60) : tr::lng_passcode_autolock_hours(tr::now, lt_count, seconds / 3600), st::autolockButton);
_options.back()->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), y);
y += _options.back()->heightNoMargins() + st::boxOptionListSkip;
}

View file

@ -207,7 +207,8 @@ bool ChangePhoneBox::EnterPhone::sendPhoneFail(const QString &phoneNumber, const
return true;
} else if (error.type() == qstr("PHONE_NUMBER_OCCUPIED")) {
Ui::show(Box<InformBox>(
lng_change_phone_occupied(
tr::lng_change_phone_occupied(
tr::now,
lt_phone,
App::formatPhone(phoneNumber)),
tr::lng_box_ok(tr::now)));

View file

@ -315,7 +315,7 @@ InformBox::InformBox(QWidget*, const TextWithEntities &text, const QString &done
MaxInviteBox::MaxInviteBox(QWidget*, not_null<ChannelData*> channel) : BoxContent()
, _channel(channel)
, _text(st::boxLabelStyle, lng_participant_invite_sorry(lt_count, Global::ChatSizeMax()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) {
, _text(st::boxLabelStyle, tr::lng_participant_invite_sorry(tr::now, lt_count, Global::ChatSizeMax()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) {
}
void MaxInviteBox::prepare() {
@ -496,8 +496,8 @@ void DeleteMessagesBox::prepare() {
details.text = peer->isSelf()
? tr::lng_sure_delete_saved_messages(tr::now)
: peer->isUser()
? lng_sure_delete_history(lt_contact, peer->name)
: lng_sure_delete_group_history(lt_group, peer->name);
? tr::lng_sure_delete_history(tr::now, lt_contact, peer->name)
: tr::lng_sure_delete_group_history(tr::now, lt_group, peer->name);
deleteStyle = &st::attentionBoxButton;
} else {
details.text = peer->isSelf()
@ -534,7 +534,7 @@ void DeleteMessagesBox::prepare() {
} else {
details.text = (_ids.size() == 1)
? tr::lng_selected_delete_sure_this(tr::now)
: lng_selected_delete_sure(lt_count, _ids.size());
: tr::lng_selected_delete_sure(tr::now, lt_count, _ids.size());
if (const auto peer = checkFromSinglePeer()) {
auto count = int(_ids.size());
if (auto revoke = revokeText(peer)) {
@ -542,12 +542,12 @@ void DeleteMessagesBox::prepare() {
appendDetails(std::move(revoke->description));
} else if (peer && peer->isChannel()) {
if (peer->isMegagroup()) {
appendDetails({ lng_delete_for_everyone_hint(lt_count, count) });
appendDetails({ tr::lng_delete_for_everyone_hint(tr::now, lt_count, count) });
}
} else if (peer->isChat()) {
appendDetails({ lng_delete_for_me_chat_hint(lt_count, count) });
appendDetails({ tr::lng_delete_for_me_chat_hint(tr::now, lt_count, count) });
} else if (!peer->isSelf()) {
appendDetails({ lng_delete_for_me_hint(lt_count, count) });
appendDetails({ tr::lng_delete_for_me_hint(tr::now, lt_count, count) });
}
}
}
@ -597,7 +597,8 @@ auto DeleteMessagesBox::revokeText(not_null<PeerData*> peer) const
if (!peer->canRevokeFullHistory()) {
return std::nullopt;
} else if (const auto user = peer->asUser()) {
result.checkbox = lng_delete_for_other_check(
result.checkbox = tr::lng_delete_for_other_check(
tr::now,
lt_user,
user->firstName);
} else {
@ -637,7 +638,8 @@ auto DeleteMessagesBox::revokeText(not_null<PeerData*> peer) const
if (canRevokeAll) {
if (const auto user = peer->asUser()) {
result.checkbox = lng_delete_for_other_check(
result.checkbox = tr::lng_delete_for_other_check(
tr::now,
lt_user,
user->firstName);
} else {

View file

@ -181,9 +181,9 @@ QString SentCodeCall::getText() const {
switch (_status.state) {
case State::Waiting: {
if (_status.timeout >= 3600) {
return lng_code_call(lt_minutes, qsl("%1:%2").arg(_status.timeout / 3600).arg((_status.timeout / 60) % 60, 2, 10, QChar('0')), lt_seconds, qsl("%1").arg(_status.timeout % 60, 2, 10, QChar('0')));
return tr::lng_code_call(tr::now, lt_minutes, qsl("%1:%2").arg(_status.timeout / 3600).arg((_status.timeout / 60) % 60, 2, 10, QChar('0')), lt_seconds, qsl("%1").arg(_status.timeout % 60, 2, 10, QChar('0')));
}
return lng_code_call(lt_minutes, QString::number(_status.timeout / 60), lt_seconds, qsl("%1").arg(_status.timeout % 60, 2, 10, QChar('0')));
return tr::lng_code_call(tr::now, lt_minutes, QString::number(_status.timeout / 60), lt_seconds, qsl("%1").arg(_status.timeout % 60, 2, 10, QChar('0')));
} break;
case State::Calling: return tr::lng_code_calling(tr::now);
case State::Called: return tr::lng_code_called(tr::now);
@ -271,7 +271,7 @@ void ConfirmPhoneBox::prepare() {
_about.create(this, st::confirmPhoneAboutLabel);
TextWithEntities aboutText;
auto formattedPhone = App::formatPhone(_phone);
aboutText.text = lng_confirm_phone_about(lt_phone, formattedPhone);
aboutText.text = tr::lng_confirm_phone_about(tr::now, lt_phone, formattedPhone);
auto phonePosition = aboutText.text.indexOf(formattedPhone);
if (phonePosition >= 0) {
aboutText.entities.push_back({ EntityType::Bold, phonePosition, formattedPhone.size() });
@ -321,7 +321,7 @@ void ConfirmPhoneBox::sendCode() {
void ConfirmPhoneBox::confirmDone(const MTPBool &result) {
_sendCodeRequestId = 0;
Ui::show(Box<InformBox>(lng_confirm_phone_success(lt_phone, App::formatPhone(_phone))));
Ui::show(Box<InformBox>(tr::lng_confirm_phone_success(tr::now, lt_phone, App::formatPhone(_phone))));
}
bool ConfirmPhoneBox::confirmFail(const RPCError &error) {

View file

@ -304,7 +304,8 @@ void ProxyRow::paintEvent(QPaintEvent *e) {
const auto status = [&] {
switch (_view.state) {
case State::Available:
return lng_proxy_available(
return tr::lng_proxy_available(
tr::now,
lt_ping,
QString::number(_view.ping));
case State::Checking:
@ -952,7 +953,8 @@ void ProxiesBoxController::ShowApplyConfirmation(
}
if (proxy) {
const auto box = std::make_shared<QPointer<ConfirmBox>>();
const auto text = lng_sure_enable_socks(
const auto text = tr::lng_sure_enable_socks(
tr::now,
lt_server,
server,
lt_port,

View file

@ -654,7 +654,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
setCloseByOutsideClick(!count);
}) | rpl::map([=](int count) {
return (count < kMaxOptionsCount)
? lng_polls_create_limit(lt_count, kMaxOptionsCount - count)
? tr::lng_polls_create_limit(tr::now, lt_count, kMaxOptionsCount - count)
: tr::lng_polls_create_maximum(tr::now);
}) | rpl::after_next([=] {
container->resizeToWidth(container->widthNoMargins());

View file

@ -95,7 +95,7 @@ std::unique_ptr<PrivacyExceptionsBoxController::Row> PrivacyExceptionsBoxControl
}();
if (count > 0) {
result->setCustomStatus(
lng_chat_status_members(lt_count_decimal, count));
tr::lng_chat_status_members(tr::now, lt_count_decimal, count));
}
return result;
}
@ -302,7 +302,7 @@ void EditPrivacyBox::setupContent() {
return Settings::ExceptionUsersCount(exceptions(exception));
}) | rpl::map([](int count) {
return count
? lng_edit_privacy_exceptions_count(lt_count, count)
? tr::lng_edit_privacy_exceptions_count(tr::now, lt_count, count)
: tr::lng_edit_privacy_exceptions_add(tr::now);
});
auto text = _controller->exceptionButtonTextKey(exception);

View file

@ -103,9 +103,9 @@ QString TimeLimitText(size_type limit) {
const auto weeks = (days / 7);
const auto months = (days / 29);
return (months > 0)
? lng_local_storage_limit_months(lt_count, months)
? tr::lng_local_storage_limit_months(tr::now, lt_count, months)
: (limit > 0)
? lng_local_storage_limit_weeks(lt_count, weeks)
? tr::lng_local_storage_limit_weeks(tr::now, lt_count, weeks)
: tr::lng_local_storage_limit_never(tr::now);
}
@ -390,7 +390,7 @@ void LocalStorageBox::setupControls() {
const auto &data = (i != end(_stats.tagged)) ? i->second : empty;
auto factory = std::forward<decltype(titleFactory)>(titleFactory);
auto title = [factory = std::move(factory)](size_type count) {
return factory(lt_count, count);
return factory(tr::now, lt_count, count);
};
tracker.track(createRow(
tag,
@ -414,11 +414,11 @@ void LocalStorageBox::setupControls() {
container,
object_ptr<Ui::PlainShadow>(container),
st::localStorageRowPadding));
createTagRow(Data::kImageCacheTag, lng_local_storage_image);
createTagRow(Data::kStickerCacheTag, lng_local_storage_sticker);
createTagRow(Data::kVoiceMessageCacheTag, lng_local_storage_voice);
createTagRow(Data::kVideoMessageCacheTag, lng_local_storage_round);
createTagRow(Data::kAnimationCacheTag, lng_local_storage_animation);
createTagRow(Data::kImageCacheTag, tr::lng_local_storage_image);
createTagRow(Data::kStickerCacheTag, tr::lng_local_storage_sticker);
createTagRow(Data::kVoiceMessageCacheTag, tr::lng_local_storage_voice);
createTagRow(Data::kVideoMessageCacheTag, tr::lng_local_storage_round);
createTagRow(Data::kAnimationCacheTag, tr::lng_local_storage_animation);
tracker.track(createRow(
kFakeMediaCacheTag,
std::move(mediaCacheTitle),
@ -506,14 +506,14 @@ void LocalStorageBox::updateTotalLabel() {
Expects(_totalLabel != nullptr);
const auto text = SizeLimitText(_totalSizeLimit);
_totalLabel->setText(lng_local_storage_size_limit(lt_size, text));
_totalLabel->setText(tr::lng_local_storage_size_limit(tr::now, lt_size, text));
}
void LocalStorageBox::updateMediaLabel() {
Expects(_mediaLabel != nullptr);
const auto text = SizeLimitText(_mediaSizeLimit);
_mediaLabel->setText(lng_local_storage_media_limit(lt_size, text));
_mediaLabel->setText(tr::lng_local_storage_media_limit(tr::now, lt_size, text));
}
void LocalStorageBox::setupLimits(not_null<Ui::VerticalLayout*> container) {
@ -555,7 +555,7 @@ void LocalStorageBox::setupLimits(not_null<Ui::VerticalLayout*> container) {
[=](not_null<Ui::LabelSimple*> label, size_type limit) {
_timeLimit = ValueToLimit(limit);
const auto text = TimeLimitText(_timeLimit);
label->setText(lng_local_storage_time_limit(lt_limit, text));
label->setText(tr::lng_local_storage_time_limit(tr::now, lt_limit, text));
limitsChanged();
});
}

View file

@ -56,9 +56,9 @@ void MuteSettingsBox::prepare() {
for (const auto hours : { 1, 4, 18, 72, kForeverHours }) {
const auto text = [&] {
if (hours < 24) {
return lng_mute_duration_hours(lt_count, hours);
return tr::lng_mute_duration_hours(tr::now, lt_count, hours);
} else if (hours < kForeverHours) {
return lng_mute_duration_days(lt_count, hours / 24);
return tr::lng_mute_duration_days(tr::now, lt_count, hours / 24);
} else {
return tr::lng_mute_duration_forever(tr::now);
}

View file

@ -67,7 +67,7 @@ PasscodeBox::PasscodeBox(QWidget*, const CloudFields &fields)
if (!_cloudFields.hint.isEmpty()) {
_hintText.setText(
st::passcodeTextStyle,
lng_signin_hint(lt_password_hint, _cloudFields.hint));
tr::lng_signin_hint(tr::now, lt_password_hint, _cloudFields.hint));
}
}
@ -912,7 +912,7 @@ RecoverBox::RecoverBox(
QWidget*,
const QString &pattern,
bool notEmptyPassport)
: _pattern(st::normalFont->elided(lng_signin_recover_hint(lt_recover_email, pattern), st::boxWidth - st::boxPadding.left() * 1.5))
: _pattern(st::normalFont->elided(tr::lng_signin_recover_hint(tr::now, lt_recover_email, pattern), st::boxWidth - st::boxPadding.left() * 1.5))
, _notEmptyPassport(notEmptyPassport)
, _recoverCode(this, st::defaultInputField, tr::lng_signin_code()) {
}

View file

@ -389,7 +389,7 @@ void PeerListRow::refreshStatus() {
if (!chat->amIn()) {
setStatusText(tr::lng_chat_status_unaccessible(tr::now));
} else if (chat->count > 0) {
setStatusText(lng_chat_status_members(lt_count_decimal, chat->count));
setStatusText(tr::lng_chat_status_members(tr::now, lt_count_decimal, chat->count));
} else {
setStatusText(tr::lng_group_status(tr::now));
}

View file

@ -418,9 +418,9 @@ void AddBotToGroupBoxController::shareBotGame(not_null<PeerData*> chat) {
});
auto confirmText = [chat] {
if (chat->isUser()) {
return lng_bot_sure_share_game(lt_user, App::peerName(chat));
return tr::lng_bot_sure_share_game(tr::now, lt_user, App::peerName(chat));
}
return lng_bot_sure_share_game_group(lt_group, chat->name);
return tr::lng_bot_sure_share_game_group(tr::now, lt_group, chat->name);
}();
Ui::show(
Box<ConfirmBox>(confirmText, std::move(send)),
@ -439,7 +439,7 @@ void AddBotToGroupBoxController::addBotToGroup(not_null<PeerData*> chat) {
auto send = crl::guard(this, [bot = _bot, chat] {
AddBotToGroup(bot, chat);
});
auto confirmText = lng_bot_sure_invite(lt_group, chat->name);
auto confirmText = tr::lng_bot_sure_invite(tr::now, lt_group, chat->name);
Ui::show(
Box<ConfirmBox>(confirmText, send),
LayerOption::KeepOther);

View file

@ -731,8 +731,11 @@ void AddSpecialBoxController::kickUser(
// Finally kick him.
if (!sure) {
const auto text = ((_peer->isChat() || _peer->isMegagroup())
? lng_profile_sure_kick
: lng_profile_sure_kick_channel)(lt_user, App::peerName(user));
? tr::lng_profile_sure_kick
: tr::lng_profile_sure_kick_channel)(
tr::now,
lt_user,
App::peerName(user));
_editBox = Ui::show(
Box<ConfirmBox>(text, kickUserSure),
LayerOption::KeepOther);

View file

@ -203,7 +203,7 @@ void Controller::sendRequest(const QString &first, const QString &last) {
weak->closeBox();
}
if (!wasContact) {
Ui::Toast::Show(lng_new_contact_add_done(lt_user, first));
Ui::Toast::Show(tr::lng_new_contact_add_done(tr::now, lt_user, first));
}
}).fail([=](const RPCError &error) {
}).send();
@ -216,7 +216,7 @@ void Controller::setupWarning() {
_box->addRow(
object_ptr<Ui::FlatLabel>(
_box,
lng_contact_phone_after(lt_user, _user->shortName()),
tr::lng_contact_phone_after(tr::now, lt_user, _user->shortName()),
st::changePhoneLabel),
st::addContactWarningMargin);
}
@ -238,7 +238,7 @@ void Controller::setupSharePhoneNumber() {
_box->addRow(
object_ptr<Ui::FlatLabel>(
_box,
lng_contact_phone_will_be_shared(lt_user, _user->shortName()),
tr::lng_contact_phone_will_be_shared(tr::now, lt_user, _user->shortName()),
st::changePhoneLabel),
st::addContactWarningMargin);

View file

@ -519,8 +519,11 @@ void EditAdminBox::sendTransferRequestFrom(
)).done([=](const MTPUpdates &result) {
api->applyUpdates(result);
Ui::Toast::Show((channel->isBroadcast()
? lng_rights_transfer_done_channel
: lng_rights_transfer_done_group)(lt_user, user->shortName()));
? tr::lng_rights_transfer_done_channel
: tr::lng_rights_transfer_done_group)(
tr::now,
lt_user,
user->shortName()));
Ui::hideLayer();
}).fail(crl::guard(this, [=](const RPCError &error) {
if (weak) {
@ -744,7 +747,8 @@ void EditRestrictedBox::createUntilVariants() {
&& until <= to) {
addVariant(
until,
lng_rights_chat_banned_custom_date(
tr::lng_rights_chat_banned_custom_date(
tr::now,
lt_date,
langDayOfMonthFull(ParseDateTime(until).date())));
}
@ -765,9 +769,9 @@ void EditRestrictedBox::createUntilVariants() {
auto nextDay = now + kSecondsInDay;
auto nextWeek = now + kSecondsInWeek;
addCurrentVariant(0, nextDay);
addVariant(kUntilOneDay, lng_rights_chat_banned_day(lt_count, 1));
addVariant(kUntilOneDay, tr::lng_rights_chat_banned_day(tr::now, lt_count, 1));
addCurrentVariant(nextDay, nextWeek);
addVariant(kUntilOneWeek, lng_rights_chat_banned_week(lt_count, 1));
addVariant(kUntilOneWeek, tr::lng_rights_chat_banned_week(tr::now, lt_count, 1));
addCurrentVariant(nextWeek, INT_MAX);
addVariant(kUntilCustom, tr::lng_rights_chat_banned_custom(tr::now));
}

View file

@ -1554,8 +1554,11 @@ void ParticipantsBoxController::editRestrictedDone(
void ParticipantsBoxController::kickMember(not_null<UserData*> user) {
const auto text = ((_peer->isChat() || _peer->isMegagroup())
? lng_profile_sure_kick
: lng_profile_sure_kick_channel)(lt_user, user->firstName);
? tr::lng_profile_sure_kick
: tr::lng_profile_sure_kick_channel)(
tr::now,
lt_user,
user->firstName);
_editBox = Ui::show(
Box<ConfirmBox>(
text,
@ -1598,7 +1601,8 @@ void ParticipantsBoxController::kickMemberSure(not_null<UserData*> user) {
void ParticipantsBoxController::removeAdmin(not_null<UserData*> user) {
_editBox = Ui::show(
Box<ConfirmBox>(
lng_profile_sure_remove_admin(
tr::lng_profile_sure_remove_admin(
tr::now,
lt_user,
user->firstName),
tr::lng_box_remove(tr::now),
@ -1752,7 +1756,8 @@ void ParticipantsBoxController::refreshCustomStatus(
const auto user = row->peer()->asUser();
if (_role == Role::Admins) {
if (const auto by = _additional.adminPromotedBy(user)) {
row->setCustomStatus(lng_channel_admin_status_promoted_by(
row->setCustomStatus(tr::lng_channel_admin_status_promoted_by(
tr::now,
lt_user,
App::peerName(by)));
} else {
@ -1767,10 +1772,11 @@ void ParticipantsBoxController::refreshCustomStatus(
} else if (_role == Role::Kicked || _role == Role::Restricted) {
const auto by = _additional.restrictedBy(user);
row->setCustomStatus((_role == Role::Kicked
? lng_channel_banned_status_removed_by
: lng_channel_banned_status_restricted_by)(
lt_user,
by ? App::peerName(by) : "Unknown"));
? tr::lng_channel_banned_status_removed_by
: tr::lng_channel_banned_status_restricted_by)(
tr::now,
lt_user,
by ? App::peerName(by) : "Unknown"));
}
}

View file

@ -81,8 +81,8 @@ void SelfDestructionBox::showContent() {
QString SelfDestructionBox::DaysLabel(int days) {
return (days > 364)
? lng_self_destruct_years(lt_count, days / 365)
: lng_self_destruct_months(lt_count, qMax(days / 30, 1));
? tr::lng_self_destruct_years(tr::now, lt_count, days / 365)
: tr::lng_self_destruct_months(tr::now, lt_count, qMax(days / 30, 1));
}
void SelfDestructionBox::prepare() {

View file

@ -1550,11 +1550,11 @@ void SendFilesBox::setupSendWayControls() {
? tr::lng_send_separate_photos_videos(tr::now)
: (_list.albumIsPossible
? tr::lng_send_separate_photos(tr::now)
: lng_send_photos(lt_count, _list.files.size())));
: tr::lng_send_photos(tr::now, lt_count, _list.files.size())));
}
addRadio(_sendFiles, SendFilesWay::Files, (_list.files.size() == 1)
? tr::lng_send_file(tr::now)
: lng_send_files(lt_count, _list.files.size()));
: tr::lng_send_files(tr::now, lt_count, _list.files.size()));
}
void SendFilesBox::applyAlbumOrder() {
@ -1753,8 +1753,8 @@ void SendFilesBox::setupTitleText() {
const auto onlyImages = (_compressConfirm != CompressConfirm::None)
&& (_albumVideosCount == 0);
_titleText = onlyImages
? lng_send_images_selected(lt_count, _list.files.size())
: lng_send_files_selected(lt_count, _list.files.size());
? tr::lng_send_images_selected(tr::now, lt_count, _list.files.size())
: tr::lng_send_files_selected(tr::now, lt_count, _list.files.size());
_titleHeight = st::boxTitleHeight;
} else {
_titleText = QString();

View file

@ -886,7 +886,7 @@ void StickersBox::Inner::paintRow(Painter &p, Row *set, int index) {
}
}
auto statusText = (set->count > 0) ? lng_stickers_count(lt_count, set->count) : tr::lng_contacts_loading(tr::now);
auto statusText = (set->count > 0) ? tr::lng_stickers_count(tr::now, lt_count, set->count) : tr::lng_contacts_loading(tr::now);
p.setFont(st::contactsStatusFont);
p.setPen(st::contactsStatusFg);

View file

@ -148,7 +148,7 @@ not_null<Ui::RpWidget*> UrlAuthBox::setupContent(
result->add(
object_ptr<Ui::FlatLabel>(
result,
lng_url_auth_open_confirm(lt_link, url),
tr::lng_url_auth_open_confirm(tr::now, lt_link, url),
st::boxLabel),
st::boxPadding);
const auto addCheckbox = [&](const QString &text) {
@ -168,7 +168,8 @@ not_null<Ui::RpWidget*> UrlAuthBox::setupContent(
return checkbox;
};
const auto auth = addCheckbox(
lng_url_auth_login_option(
tr::lng_url_auth_login_option(
tr::now,
lt_domain,
textcmdStartSemibold() + domain + textcmdStopSemibold(),
lt_user,
@ -176,7 +177,8 @@ not_null<Ui::RpWidget*> UrlAuthBox::setupContent(
+ App::peerName(Auth().user())
+ textcmdStopSemibold())));
const auto allow = bot
? addCheckbox(lng_url_auth_allow_messages(
? addCheckbox(tr::lng_url_auth_allow_messages(
tr::now,
lt_bot,
textcmdStartSemibold() + bot->firstName + textcmdStopSemibold()))
: nullptr;

View file

@ -165,11 +165,11 @@ void BoxController::Row::refreshStatus() {
auto time = ItemDateTime(_items.front()).time().toString(cTimeFormat());
auto today = QDateTime::currentDateTime().date();
if (_date == today) {
return lng_call_box_status_today(lt_time, time);
return tr::lng_call_box_status_today(tr::now, lt_time, time);
} else if (_date.addDays(1) == today) {
return lng_call_box_status_yesterday(lt_time, time);
return tr::lng_call_box_status_yesterday(tr::now, lt_time, time);
}
return lng_call_box_status_date(lt_date, langDayOfMonthFull(_date), lt_time, time);
return tr::lng_call_box_status_date(tr::now, lt_date, langDayOfMonthFull(_date), lt_time, time);
};
setCustomStatus((_items.size() > 1)
? tr::lng_call_box_status_group(

View file

@ -872,9 +872,9 @@ void Call::setFailedQueued(int error) {
void Call::handleRequestError(const RPCError &error) {
if (error.type() == qstr("USER_PRIVACY_RESTRICTED")) {
Ui::show(Box<InformBox>(lng_call_error_not_available(lt_user, App::peerName(_user))));
Ui::show(Box<InformBox>(tr::lng_call_error_not_available(tr::now, lt_user, App::peerName(_user))));
} else if (error.type() == qstr("PARTICIPANT_VERSION_OUTDATED")) {
Ui::show(Box<InformBox>(lng_call_error_outdated(lt_user, App::peerName(_user))));
Ui::show(Box<InformBox>(tr::lng_call_error_outdated(tr::now, lt_user, App::peerName(_user))));
} else if (error.type() == qstr("CALL_PROTOCOL_LAYER_INVALID")) {
Ui::show(Box<InformBox>(Lang::Hard::CallErrorIncompatible().replace("{user}", App::peerName(_user))));
}

View file

@ -39,7 +39,7 @@ void Instance::startOutgoingCall(not_null<UserData*> user) {
if (user->callsStatus() == UserData::CallsStatus::Private) {
// Request full user once more to refresh the setting in case it was changed.
Auth().api().requestFullPeer(user);
Ui::show(Box<InformBox>(lng_call_error_not_available(lt_user, App::peerName(user))));
Ui::show(Box<InformBox>(tr::lng_call_error_not_available(tr::now, lt_user, App::peerName(user))));
return;
}
requestMicrophonePermissionOrFail(crl::guard(this, [=] {

View file

@ -811,7 +811,7 @@ void Panel::leaveToChildEvent(QEvent *e, QWidget *child) {
}
QString Panel::tooltipText() const {
return lng_call_fingerprint_tooltip(lt_user, App::peerName(_user));
return tr::lng_call_fingerprint_tooltip(tr::now, lt_user, App::peerName(_user));
}
QPoint Panel::tooltipPos() const {

View file

@ -167,7 +167,7 @@ SetState ComputeState(int id) {
QString StateDescription(const SetState &state) {
return state.match([](const Available &data) {
return lng_emoji_set_download(lt_size, formatSizeText(data.size));
return tr::lng_emoji_set_download(tr::now, lt_size, formatSizeText(data.size));
}, [](const Ready &data) -> QString {
return tr::lng_emoji_set_ready(tr::now);
}, [](const Active &data) -> QString {
@ -176,7 +176,8 @@ QString StateDescription(const SetState &state) {
const auto percent = (data.size > 0)
? snap((data.already * 100) / float64(data.size), 0., 100.)
: 0.;
return lng_emoji_set_loading(
return tr::lng_emoji_set_loading(
tr::now,
lt_percent,
QString::number(int(std::round(percent))) + '%',
lt_progress,

View file

@ -1241,7 +1241,7 @@ void StickersListWidget::paintStickers(Painter &p, QRect clip) {
}
}
auto statusText = (size > 0) ? lng_stickers_count(lt_count, size) : tr::lng_contacts_loading(tr::now);
auto statusText = (size > 0) ? tr::lng_stickers_count(tr::now, lt_count, size) : tr::lng_contacts_loading(tr::now);
p.setFont(st::stickersTrendingSubheaderFont);
p.setPen(st::stickersTrendingSubheaderFg);
p.drawTextLeft(st::emojiPanHeaderLeft - st::buttonRadius, info.top + st::stickersTrendingSubheaderTop, width(), statusText);
@ -2435,7 +2435,7 @@ void StickersListWidget::removeSet(uint64 setId) {
auto it = sets.constFind(setId);
if (it != sets.cend()) {
_removingSetId = it->id;
auto text = lng_stickers_remove_pack(lt_sticker_pack, it->title);
auto text = tr::lng_stickers_remove_pack(tr::now, lt_sticker_pack, it->title);
Ui::show(Box<ConfirmBox>(text, tr::lng_stickers_remove_pack_confirm(tr::now), crl::guard(this, [=] {
Ui::hideLayer();
auto &sets = Auth().data().stickerSetsRef();

View file

@ -108,7 +108,6 @@ bool Generator::writeHeader() {
writeHeaderTagTypes();
writeHeaderInterface();
writeHeaderReactiveInterface();
writeHeaderTaggedMethods();
return header_->finalize();
}
@ -116,8 +115,8 @@ bool Generator::writeHeader() {
void Generator::writeHeaderForwardDeclarations() {
header_->pushNamespace("Lang").stream() << "\
\n\
inline constexpr ushort kTagsCount = " << langpack_.tags.size() << ";\n\
inline constexpr ushort kKeysCount = " << langpack_.entries.size() << ";\n\
inline constexpr auto kTagsCount = ushort(" << langpack_.tags.size() << ");\n\
inline constexpr auto kKeysCount = ushort(" << langpack_.entries.size() << ");\n\
\n";
header_->popNamespace().newline();
}
@ -141,27 +140,6 @@ void Generator::writeHeaderTagTypes() {
header_->newline();
}
void Generator::writeHeaderTaggedMethods() {
for (auto &entry : langpack_.entries) {
auto isPlural = !entry.keyBase.isEmpty();
auto &key = entry.key;
auto params = QStringList();
auto args = QStringList();
for (auto &tagData : entry.tags) {
auto &tag = tagData.tag;
auto isPluralTag = isPlural && (tag == kPluralTags[0]);
params.push_back("lngtag_" + tag + (isPluralTag ? " type" : "") + ", " + (isPluralTag ? "float64 " : "const QString &") + tag + "__val");
args.push_back((isPluralTag ? "type" : ("lt_" + tag)) + ", " + tag + "__val");
}
if (!entry.tags.empty() && (!isPlural || key == ComputePluralKey(entry.keyBase, 0))) {
header_->stream() << "\
inline QString " << (isPlural ? entry.keyBase : key) << "(" << params.join(QString(", ")) << ") {\n\
return tr::" << (isPlural ? entry.keyBase : key) << "(tr::now, " << args.join(QString(", ")) << ");\n\
}\n";
}
}
}
void Generator::writeHeaderInterface() {
header_->pushNamespace("Lang").stream() << "\
\n\
@ -219,6 +197,12 @@ struct now_t {\n\
\n\
inline constexpr now_t now{};\n\
\n\
inline auto to_count() {\n\
return rpl::map([](auto value) {\n\
return float64(value);\n\
});\n\
}\n\
\n\
template <typename ...Tags>\n\
struct phrase;\n\
\n";
@ -297,6 +281,7 @@ inline constexpr phrase<" << tags.join(", ") << "> " << (isPlural ? entry.keyBas
}
void Generator::writeSourceLangKeyConstants() {
source_->newline();
auto index = 0;
for (auto &entry : langpack_.entries) {
source_->stream() << "constexpr auto " << getFullKey(entry) << " = ushort(" << (index++) << ");\n";
@ -312,7 +297,6 @@ bool Generator::writeSource() {
writeSourceLangKeyConstants();
source_->stream() << "\
\n\
QChar DefaultData[] = {";
auto count = 0;
auto fulllength = 0;

View file

@ -31,7 +31,6 @@ public:
private:
void writeHeaderForwardDeclarations();
void writeHeaderTagTypes();
void writeHeaderTaggedMethods();
void writeHeaderInterface();
void writeHeaderTagValueLookup();
void writeHeaderReactiveInterface();

View file

@ -122,7 +122,8 @@ void Changelogs::addLocalLogs() {
addBetaLogs();
}
if (!_addedSomeLocal) {
const auto text = lng_new_version_wrap(
const auto text = tr::lng_new_version_wrap(
tr::now,
lt_version,
QString::fromLatin1(AppVersionStr),
lt_changes,

View file

@ -193,7 +193,7 @@ void BotGameUrlClickHandler::onClick(ClickContext context) const {
open();
};
Ui::show(Box<ConfirmBox>(
lng_allow_bot_pass(lt_bot_name, _bot->name),
tr::lng_allow_bot_pass(tr::now, lt_bot_name, _bot->name),
tr::lng_allow_bot(tr::now),
callback));
}

View file

@ -90,15 +90,15 @@ QString WithCaptionDialogsText(
return textcmdLink(1, TextUtilities::Clean(attachType));
}
auto captionText = TextUtilities::Clean(caption);
auto attachTypeWrapped = textcmdLink(1, lng_dialogs_text_media_wrapped(
lt_media,
TextUtilities::Clean(attachType)));
return lng_dialogs_text_media(
return tr::lng_dialogs_text_media(
tr::now,
lt_media_part,
attachTypeWrapped,
textcmdLink(1, tr::lng_dialogs_text_media_wrapped(
tr::now,
lt_media,
TextUtilities::Clean(attachType))),
lt_caption,
captionText);
TextUtilities::Clean(caption));
}
QString WithCaptionNotificationText(
@ -108,12 +108,13 @@ QString WithCaptionNotificationText(
return attachType;
}
auto attachTypeWrapped = lng_dialogs_text_media_wrapped(
lt_media,
attachType);
return lng_dialogs_text_media(
return tr::lng_dialogs_text_media(
tr::now,
lt_media_part,
attachTypeWrapped,
tr::lng_dialogs_text_media_wrapped(
tr::now,
lt_media,
attachType),
lt_caption,
caption);
}
@ -586,7 +587,7 @@ QString MediaFile::notificationText() const {
if (const auto sticker = _document->sticker()) {
return _emoji.isEmpty()
? tr::lng_in_dlg_sticker(tr::now)
: lng_in_dlg_sticker_emoji(lt_emoji, _emoji);
: tr::lng_in_dlg_sticker_emoji(tr::now, lt_emoji, _emoji);
}
const auto type = [&] {
if (_document->isVideoMessage()) {
@ -610,7 +611,7 @@ QString MediaFile::notificationText() const {
QString MediaFile::pinnedTextSubstring() const {
if (const auto sticker = _document->sticker()) {
if (!_emoji.isEmpty()) {
return lng_action_pinned_media_emoji_sticker(lt_emoji, _emoji);
return tr::lng_action_pinned_media_emoji_sticker(tr::now, lt_emoji, _emoji);
}
return tr::lng_action_pinned_media_sticker(tr::now);
} else if (_document->isAnimation()) {
@ -636,7 +637,7 @@ TextForMimeData MediaFile::clipboardText() const {
: QString();
if (const auto sticker = _document->sticker()) {
if (!_emoji.isEmpty()) {
return lng_in_dlg_sticker_emoji(lt_emoji, _emoji);
return tr::lng_in_dlg_sticker_emoji(tr::now, lt_emoji, _emoji);
}
return tr::lng_in_dlg_sticker(tr::now);
} else if (_document->isAnimation()) {
@ -816,7 +817,8 @@ QString MediaContact::pinnedTextSubstring() const {
TextForMimeData MediaContact::clipboardText() const {
const auto text = qsl("[ ") + tr::lng_in_dlg_contact(tr::now) + qsl(" ]\n")
+ lng_full_name(
+ tr::lng_full_name(
tr::now,
lt_first_name,
_contact.firstName,
lt_last_name,
@ -953,7 +955,8 @@ const Call *MediaCall::call() const {
QString MediaCall::notificationText() const {
auto result = Text(parent(), _call.finishReason);
if (_call.duration > 0) {
result = lng_call_type_and_duration(
result = tr::lng_call_type_and_duration(
tr::now,
lt_type,
result,
lt_duration,
@ -1133,7 +1136,7 @@ GameData *MediaGame::game() const {
QString MediaGame::pinnedTextSubstring() const {
const auto title = _game->title;
return lng_action_pinned_media_game(lt_game, title);
return tr::lng_action_pinned_media_game(tr::now, lt_game, title);
}
TextForMimeData MediaGame::clipboardText() const {

View file

@ -299,23 +299,23 @@ QString OnlineText(TimeId online, TimeId now) {
if (!minutes) {
return tr::lng_status_lastseen_now(tr::now);
} else if (minutes < 60) {
return lng_status_lastseen_minutes(lt_count, minutes);
return tr::lng_status_lastseen_minutes(tr::now, lt_count, minutes);
}
const auto hours = (now - online) / 3600;
if (hours < 12) {
return lng_status_lastseen_hours(lt_count, hours);
return tr::lng_status_lastseen_hours(tr::now, lt_count, hours);
}
const auto onlineFull = ParseDateTime(online);
const auto nowFull = ParseDateTime(now);
if (onlineFull.date() == nowFull.date()) {
const auto onlineTime = onlineFull.time().toString(cTimeFormat());
return lng_status_lastseen_today(lt_time, onlineTime);
return tr::lng_status_lastseen_today(tr::now, lt_time, onlineTime);
} else if (onlineFull.date().addDays(1) == nowFull.date()) {
const auto onlineTime = onlineFull.time().toString(cTimeFormat());
return lng_status_lastseen_yesterday(lt_time, onlineTime);
return tr::lng_status_lastseen_yesterday(tr::now, lt_time, onlineTime);
}
const auto date = onlineFull.date().toString(qsl("dd.MM.yy"));
return lng_status_lastseen_date(lt_date, date);
return tr::lng_status_lastseen_date(tr::now, lt_date, date);
}
QString OnlineText(not_null<UserData*> user, TimeId now) {
@ -335,14 +335,14 @@ QString OnlineTextFull(not_null<UserData*> user, TimeId now) {
const auto nowFull = ParseDateTime(now);
if (onlineFull.date() == nowFull.date()) {
const auto onlineTime = onlineFull.time().toString(cTimeFormat());
return lng_status_lastseen_today(lt_time, onlineTime);
return tr::lng_status_lastseen_today(tr::now, lt_time, onlineTime);
} else if (onlineFull.date().addDays(1) == nowFull.date()) {
const auto onlineTime = onlineFull.time().toString(cTimeFormat());
return lng_status_lastseen_yesterday(lt_time, onlineTime);
return tr::lng_status_lastseen_yesterday(tr::now, lt_time, onlineTime);
}
const auto date = onlineFull.date().toString(qsl("dd.MM.yy"));
const auto time = onlineFull.time().toString(cTimeFormat());
return lng_status_lastseen_date_time(lt_date, date, lt_time, time);
return tr::lng_status_lastseen_date_time(tr::now, lt_date, date, lt_time, time);
}
bool OnlineTextActive(TimeId online, TimeId now) {

View file

@ -113,7 +113,7 @@ void UserData::setName(const QString &newFirstName, const QString &newLastName,
firstName = newFirstName;
lastName = newLastName;
}
newFullName = lastName.isEmpty() ? firstName : lng_full_name(lt_first_name, firstName, lt_last_name, lastName);
newFullName = lastName.isEmpty() ? firstName : tr::lng_full_name(tr::now, lt_first_name, firstName, lt_last_name, lastName);
}
updateNameDelayed(newFullName, newPhoneName, newUsername);
}

View file

@ -614,7 +614,8 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
? tr::lng_search_no_results(tr::now)
: showUnreadInSearchResults
? qsl("Search results")
: lng_search_found_results(
: tr::lng_search_found_results(
tr::now,
lt_count,
_searchedMigratedCount + _searchedCount);
p.fillRect(0, 0, fullWidth, st::searchedBarHeight, st::searchedBarBg);
@ -2251,7 +2252,8 @@ void InnerWidget::refreshSearchInChatLabel() {
return QString();
}();
if (!from.isEmpty()) {
const auto fromUserText = lng_dlg_search_from(
const auto fromUserText = tr::lng_dlg_search_from(
tr::now,
lt_user,
textcmdLink(1, from));
_searchFromUserText.setText(

View file

@ -329,10 +329,10 @@ void paintRow(
auto &color = active ? st::dialogsTextFgServiceActive : (selected ? st::dialogsTextFgServiceOver : st::dialogsTextFgService);
if (history && !history->paintSendAction(p, nameleft, texttop, availableWidth, fullWidth, color, ms)) {
if (history->cloudDraftTextCache.isEmpty()) {
auto draftWrapped = textcmdLink(1, lng_dialogs_text_from_wrapped(lt_from, tr::lng_from_draft(tr::now)));
auto draftWrapped = textcmdLink(1, tr::lng_dialogs_text_from_wrapped(tr::now, lt_from, tr::lng_from_draft(tr::now)));
auto draftText = supportMode
? textcmdLink(1, Support::ChatOccupiedString(history))
: lng_dialogs_text_with_from(lt_from_part, draftWrapped, lt_message, TextUtilities::Clean(draft->textWithTags.text));
: tr::lng_dialogs_text_with_from(tr::now, lt_from_part, draftWrapped, lt_message, TextUtilities::Clean(draft->textWithTags.text));
history->cloudDraftTextCache.setText(st::dialogsTextStyle, draftText, Ui::DialogTextOptions());
}
p.setPen(active ? st::dialogsTextFgActive : (selected ? st::dialogsTextFgOver : st::dialogsTextFg));

View file

@ -52,7 +52,8 @@ QString ComposeFolderListEntryText(not_null<Data::Folder*> folder) {
auto i = peers.begin();
auto result = wrapName(*i);
for (++i; i != peers.end(); ++i) {
result = lng_archived_last_list(
result = tr::lng_archived_last_list(
tr::now,
lt_accumulated,
result,
lt_chat,
@ -61,7 +62,7 @@ QString ComposeFolderListEntryText(not_null<Data::Folder*> folder) {
return result;
}();
return (shown < count)
? lng_archived_last(lt_count, (count - shown), lt_chats, accumulated)
? tr::lng_archived_last(tr::now, lt_count, (count - shown), lt_chats, accumulated)
: accumulated;
}

View file

@ -199,9 +199,10 @@ void PanelController::showError(const ApiErrorState &error) {
if (hours <= 0) {
return tr::lng_export_delay_less_than_hour(tr::now);
}
return lng_export_delay_hours(lt_count, hours);
return tr::lng_export_delay_hours(tr::now, lt_count, hours);
}();
showError(lng_export_delay(
showError(tr::lng_export_delay(
tr::now,
lt_hours,
hoursText,
lt_date,

View file

@ -611,7 +611,7 @@ void SettingsWidget::addSizeSlider(
}) | rpl::start_with_next([=](int sizeLimit) {
const auto limit = sizeLimit / kMegabyte;
const auto size = QString::number(limit) + " MB";
const auto text = lng_export_option_size_limit(lt_size, size);
const auto text = tr::lng_export_option_size_limit(tr::now, lt_size, size);
label->setText(text);
}, slider->lifetime());

View file

@ -384,7 +384,14 @@ void GenerateItems(
};
auto createChangeTitle = [&](const MTPDchannelAdminLogEventActionChangeTitle &action) {
auto text = (channel->isMegagroup() ? lng_action_changed_title : lng_admin_log_changed_title_channel)(lt_from, fromLinkText, lt_title, qs(action.vnew_value));
auto text = (channel->isMegagroup()
? tr::lng_action_changed_title
: tr::lng_admin_log_changed_title_channel)(
tr::now,
lt_from,
fromLinkText,
lt_title,
qs(action.vnew_value));
addSimpleServiceMessage(text);
};
@ -392,9 +399,13 @@ void GenerateItems(
auto newValue = qs(action.vnew_value);
auto oldValue = qs(action.vprev_value);
auto text = (channel->isMegagroup()
? (newValue.isEmpty() ? lng_admin_log_removed_description_group : lng_admin_log_changed_description_group)
: (newValue.isEmpty() ? lng_admin_log_removed_description_channel : lng_admin_log_changed_description_channel)
)(lt_from, fromLinkText);
? (newValue.isEmpty()
? tr::lng_admin_log_removed_description_group
: tr::lng_admin_log_changed_description_group)
: (newValue.isEmpty()
? tr::lng_admin_log_removed_description_channel
: tr::lng_admin_log_changed_description_channel)
)(tr::now, lt_from, fromLinkText);
addSimpleServiceMessage(text);
auto bodyFlags = Flag::f_entities | Flag::f_from_id;
@ -413,9 +424,13 @@ void GenerateItems(
auto newValue = qs(action.vnew_value);
auto oldValue = qs(action.vprev_value);
auto text = (channel->isMegagroup()
? (newValue.isEmpty() ? lng_admin_log_removed_link_group : lng_admin_log_changed_link_group)
: (newValue.isEmpty() ? lng_admin_log_removed_link_channel : lng_admin_log_changed_link_channel)
)(lt_from, fromLinkText);
? (newValue.isEmpty()
? tr::lng_admin_log_removed_link_group
: tr::lng_admin_log_changed_link_group)
: (newValue.isEmpty()
? tr::lng_admin_log_removed_link_channel
: tr::lng_admin_log_changed_link_channel)
)(tr::now, lt_from, fromLinkText);
addSimpleServiceMessage(text);
auto bodyFlags = Flag::f_entities | Flag::f_from_id;
@ -433,10 +448,20 @@ void GenerateItems(
auto createChangePhoto = [&](const MTPDchannelAdminLogEventActionChangePhoto &action) {
action.vnew_photo.match([&](const MTPDphoto &data) {
auto photo = Auth().data().processPhoto(data);
auto text = (channel->isMegagroup() ? lng_admin_log_changed_photo_group : lng_admin_log_changed_photo_channel)(lt_from, fromLinkText);
auto text = (channel->isMegagroup()
? tr::lng_admin_log_changed_photo_group
: tr::lng_admin_log_changed_photo_channel)(
tr::now,
lt_from,
fromLinkText);
addSimpleServiceMessage(text, photo);
}, [&](const MTPDphotoEmpty &data) {
auto text = (channel->isMegagroup() ? lng_admin_log_removed_photo_group : lng_admin_log_removed_photo_channel)(lt_from, fromLinkText);
auto text = (channel->isMegagroup()
? tr::lng_admin_log_removed_photo_group
: tr::lng_admin_log_removed_photo_channel)(
tr::now,
lt_from,
fromLinkText);
addSimpleServiceMessage(text);
});
};
@ -444,25 +469,25 @@ void GenerateItems(
auto createToggleInvites = [&](const MTPDchannelAdminLogEventActionToggleInvites &action) {
auto enabled = (action.vnew_value.type() == mtpc_boolTrue);
auto text = (enabled
? lng_admin_log_invites_enabled
: lng_admin_log_invites_disabled);
addSimpleServiceMessage(text(lt_from, fromLinkText));
? tr::lng_admin_log_invites_enabled
: tr::lng_admin_log_invites_disabled);
addSimpleServiceMessage(text(tr::now, lt_from, fromLinkText));
};
auto createToggleSignatures = [&](const MTPDchannelAdminLogEventActionToggleSignatures &action) {
auto enabled = (action.vnew_value.type() == mtpc_boolTrue);
auto text = (enabled
? lng_admin_log_signatures_enabled
: lng_admin_log_signatures_disabled);
addSimpleServiceMessage(text(lt_from, fromLinkText));
? tr::lng_admin_log_signatures_enabled
: tr::lng_admin_log_signatures_disabled);
addSimpleServiceMessage(text(tr::now, lt_from, fromLinkText));
};
auto createUpdatePinned = [&](const MTPDchannelAdminLogEventActionUpdatePinned &action) {
if (action.vmessage.type() == mtpc_messageEmpty) {
auto text = lng_admin_log_unpinned_message(lt_from, fromLinkText);
auto text = tr::lng_admin_log_unpinned_message(tr::now, lt_from, fromLinkText);
addSimpleServiceMessage(text);
} else {
auto text = lng_admin_log_pinned_message(lt_from, fromLinkText);
auto text = tr::lng_admin_log_pinned_message(tr::now, lt_from, fromLinkText);
addSimpleServiceMessage(text);
auto detachExistingItem = false;
@ -478,10 +503,14 @@ void GenerateItems(
auto createEditMessage = [&](const MTPDchannelAdminLogEventActionEditMessage &action) {
auto newValue = ExtractEditedText(action.vnew_message);
auto canHaveCaption = MediaCanHaveCaption(action.vnew_message);
auto text = (canHaveCaption
? (newValue.text.isEmpty() ? lng_admin_log_removed_caption : lng_admin_log_edited_caption)
: lng_admin_log_edited_message
)(lt_from, fromLinkText);
auto text = (!canHaveCaption
? tr::lng_admin_log_edited_message
: newValue.text.isEmpty()
? tr::lng_admin_log_removed_caption
: tr::lng_admin_log_edited_caption)(
tr::now,
lt_from,
fromLinkText);
addSimpleServiceMessage(text);
auto oldValue = ExtractEditedText(action.vprev_message);
@ -506,7 +535,7 @@ void GenerateItems(
};
auto createDeleteMessage = [&](const MTPDchannelAdminLogEventActionDeleteMessage &action) {
auto text = lng_admin_log_deleted_message(lt_from, fromLinkText);
auto text = tr::lng_admin_log_deleted_message(tr::now, lt_from, fromLinkText);
addSimpleServiceMessage(text);
auto detachExistingItem = false;
@ -517,16 +546,16 @@ void GenerateItems(
auto createParticipantJoin = [&]() {
auto text = (channel->isMegagroup()
? lng_admin_log_participant_joined
: lng_admin_log_participant_joined_channel);
addSimpleServiceMessage(text(lt_from, fromLinkText));
? tr::lng_admin_log_participant_joined
: tr::lng_admin_log_participant_joined_channel);
addSimpleServiceMessage(text(tr::now, lt_from, fromLinkText));
};
auto createParticipantLeave = [&]() {
auto text = (channel->isMegagroup()
? lng_admin_log_participant_left
: lng_admin_log_participant_left_channel);
addSimpleServiceMessage(text(lt_from, fromLinkText));
? tr::lng_admin_log_participant_left
: tr::lng_admin_log_participant_left_channel);
addSimpleServiceMessage(text(tr::now, lt_from, fromLinkText));
};
auto createParticipantInvite = [&](const MTPDchannelAdminLogEventActionParticipantInvite &action) {
@ -557,10 +586,11 @@ void GenerateItems(
auto set = action.vnew_stickerset;
auto removed = (set.type() == mtpc_inputStickerSetEmpty);
if (removed) {
auto text = lng_admin_log_removed_stickers_group(lt_from, fromLinkText);
auto text = tr::lng_admin_log_removed_stickers_group(tr::now, lt_from, fromLinkText);
addSimpleServiceMessage(text);
} else {
auto text = lng_admin_log_changed_stickers_group(
auto text = tr::lng_admin_log_changed_stickers_group(
tr::now,
lt_from,
fromLinkText,
lt_sticker_set,
@ -578,9 +608,9 @@ void GenerateItems(
auto createTogglePreHistoryHidden = [&](const MTPDchannelAdminLogEventActionTogglePreHistoryHidden &action) {
auto hidden = (action.vnew_value.type() == mtpc_boolTrue);
auto text = (hidden
? lng_admin_log_history_made_hidden
: lng_admin_log_history_made_visible);
addSimpleServiceMessage(text(lt_from, fromLinkText));
? tr::lng_admin_log_history_made_hidden
: tr::lng_admin_log_history_made_visible);
addSimpleServiceMessage(text(tr::now, lt_from, fromLinkText));
};
auto createDefaultBannedRights = [&](const MTPDchannelAdminLogEventActionDefaultBannedRights &action) {
@ -592,7 +622,7 @@ void GenerateItems(
};
auto createStopPoll = [&](const MTPDchannelAdminLogEventActionStopPoll &action) {
auto text = lng_admin_log_stopped_poll(lt_from, fromLinkText);
auto text = tr::lng_admin_log_stopped_poll(tr::now, lt_from, fromLinkText);
addSimpleServiceMessage(text);
auto detachExistingItem = false;
@ -606,14 +636,22 @@ void GenerateItems(
const auto was = history->owner().channelLoaded(action.vprev_value.v);
const auto now = history->owner().channelLoaded(action.vnew_value.v);
if (!now) {
auto text = (broadcast ? lng_admin_log_removed_linked_chat : lng_admin_log_removed_linked_channel)(lt_from, fromLinkText);
auto text = (broadcast
? tr::lng_admin_log_removed_linked_chat
: tr::lng_admin_log_removed_linked_channel)(
tr::now,
lt_from,
fromLinkText);
addSimpleServiceMessage(text);
} else {
auto text = (broadcast ? lng_admin_log_changed_linked_chat : lng_admin_log_changed_linked_channel)(
lt_from,
fromLinkText,
lt_chat,
textcmdLink(2, now->name));
auto text = (broadcast
? tr::lng_admin_log_changed_linked_chat
: tr::lng_admin_log_changed_linked_channel)(
tr::now,
lt_from,
fromLinkText,
lt_chat,
textcmdLink(2, now->name));
auto chatLink = std::make_shared<LambdaClickHandler>([=] {
Ui::showPeerHistory(now, ShowAtUnreadMsgId);
});
@ -634,14 +672,15 @@ void GenerateItems(
}, [&](const MTPDgeoPointEmpty &) {
return address;
});
const auto text = lng_admin_log_changed_location_chat(
const auto text = tr::lng_admin_log_changed_location_chat(
tr::now,
lt_from,
fromLinkText,
lt_address,
link);
addSimpleServiceMessage(text);
}, [&](const MTPDchannelLocationEmpty &) {
const auto text = lng_admin_log_removed_location_chat(lt_from, fromLinkText);
const auto text = tr::lng_admin_log_removed_location_chat(tr::now, lt_from, fromLinkText);
addSimpleServiceMessage(text);
});
};

View file

@ -479,9 +479,10 @@ bool History::updateSendActionNeedsAnimating(crl::time now, bool force) {
QString newTypingString;
auto typingCount = _typing.size();
if (typingCount > 2) {
newTypingString = lng_many_typing(lt_count, typingCount);
newTypingString = tr::lng_many_typing(tr::now, lt_count, typingCount);
} else if (typingCount > 1) {
newTypingString = lng_users_typing(
newTypingString = tr::lng_users_typing(
tr::now,
lt_user,
begin(_typing)->first->firstName,
lt_second_user,
@ -489,7 +490,8 @@ bool History::updateSendActionNeedsAnimating(crl::time now, bool force) {
} else if (typingCount) {
newTypingString = peer->isUser()
? tr::lng_typing(tr::now)
: lng_user_typing(
: tr::lng_user_typing(
tr::now,
lt_user,
begin(_typing)->first->firstName);
} else if (!_sendActions.empty()) {
@ -497,16 +499,16 @@ bool History::updateSendActionNeedsAnimating(crl::time now, bool force) {
using Type = SendAction::Type;
auto sendActionString = [](Type type, const QString &name) -> QString {
switch (type) {
case Type::RecordVideo: return name.isEmpty() ? tr::lng_send_action_record_video(tr::now) : lng_user_action_record_video(lt_user, name);
case Type::UploadVideo: return name.isEmpty() ? tr::lng_send_action_upload_video(tr::now) : lng_user_action_upload_video(lt_user, name);
case Type::RecordVoice: return name.isEmpty() ? tr::lng_send_action_record_audio(tr::now) : lng_user_action_record_audio(lt_user, name);
case Type::UploadVoice: return name.isEmpty() ? tr::lng_send_action_upload_audio(tr::now) : lng_user_action_upload_audio(lt_user, name);
case Type::RecordRound: return name.isEmpty() ? tr::lng_send_action_record_round(tr::now) : lng_user_action_record_round(lt_user, name);
case Type::UploadRound: return name.isEmpty() ? tr::lng_send_action_upload_round(tr::now) : lng_user_action_upload_round(lt_user, name);
case Type::UploadPhoto: return name.isEmpty() ? tr::lng_send_action_upload_photo(tr::now) : lng_user_action_upload_photo(lt_user, name);
case Type::UploadFile: return name.isEmpty() ? tr::lng_send_action_upload_file(tr::now) : lng_user_action_upload_file(lt_user, name);
case Type::RecordVideo: return name.isEmpty() ? tr::lng_send_action_record_video(tr::now) : tr::lng_user_action_record_video(tr::now, lt_user, name);
case Type::UploadVideo: return name.isEmpty() ? tr::lng_send_action_upload_video(tr::now) : tr::lng_user_action_upload_video(tr::now, lt_user, name);
case Type::RecordVoice: return name.isEmpty() ? tr::lng_send_action_record_audio(tr::now) : tr::lng_user_action_record_audio(tr::now, lt_user, name);
case Type::UploadVoice: return name.isEmpty() ? tr::lng_send_action_upload_audio(tr::now) : tr::lng_user_action_upload_audio(tr::now, lt_user, name);
case Type::RecordRound: return name.isEmpty() ? tr::lng_send_action_record_round(tr::now) : tr::lng_user_action_record_round(tr::now, lt_user, name);
case Type::UploadRound: return name.isEmpty() ? tr::lng_send_action_upload_round(tr::now) : tr::lng_user_action_upload_round(tr::now, lt_user, name);
case Type::UploadPhoto: return name.isEmpty() ? tr::lng_send_action_upload_photo(tr::now) : tr::lng_user_action_upload_photo(tr::now, lt_user, name);
case Type::UploadFile: return name.isEmpty() ? tr::lng_send_action_upload_file(tr::now) : tr::lng_user_action_upload_file(tr::now, lt_user, name);
case Type::ChooseLocation:
case Type::ChooseContact: return name.isEmpty() ? tr::lng_typing(tr::now) : lng_user_typing(lt_user, name);
case Type::ChooseContact: return name.isEmpty() ? tr::lng_typing(tr::now) : tr::lng_user_typing(tr::now, lt_user, name);
default: break;
};
return QString();
@ -525,11 +527,13 @@ bool History::updateSendActionNeedsAnimating(crl::time now, bool force) {
if (newTypingString.isEmpty()) {
int playingCount = _sendActions.size();
if (playingCount > 2) {
newTypingString = lng_many_playing_game(
newTypingString = tr::lng_many_playing_game(
tr::now,
lt_count,
playingCount);
} else if (playingCount > 1) {
newTypingString = lng_users_playing_game(
newTypingString = tr::lng_users_playing_game(
tr::now,
lt_user,
begin(_sendActions)->first->firstName,
lt_second_user,
@ -537,7 +541,8 @@ bool History::updateSendActionNeedsAnimating(crl::time now, bool force) {
} else {
newTypingString = peer->isUser()
? tr::lng_playing_game(tr::now)
: lng_user_playing_game(
: tr::lng_user_playing_game(
tr::now,
lt_user,
begin(_sendActions)->first->firstName);
}

View file

@ -3100,21 +3100,24 @@ QString HistoryInner::tooltipText() const {
auto dateText = view->dateTime().toString(
QLocale::system().dateTimeFormat(QLocale::LongFormat));
if (const auto editedDate = view->displayedEditDate()) {
dateText += '\n' + lng_edited_date(
dateText += '\n' + tr::lng_edited_date(
tr::now,
lt_date,
ParseDateTime(editedDate).toString(
QLocale::system().dateTimeFormat(
QLocale::LongFormat)));
}
if (const auto forwarded = view->data()->Get<HistoryMessageForwarded>()) {
dateText += '\n' + lng_forwarded_date(
dateText += '\n' + tr::lng_forwarded_date(
tr::now,
lt_date,
ParseDateTime(forwarded->originalDate).toString(
QLocale::system().dateTimeFormat(
QLocale::LongFormat)));
if (const auto media = view->media()) {
if (media->hidesForwardedInfo()) {
dateText += "\n" + lng_forwarded(
dateText += "\n" + tr::lng_forwarded(
tr::now,
lt_user,
(forwarded->originalSender
? forwarded->originalSender->shortName()
@ -3124,7 +3127,7 @@ QString HistoryInner::tooltipText() const {
}
if (const auto msgsigned = view->data()->Get<HistoryMessageSigned>()) {
if (msgsigned->isElided) {
dateText += '\n' + lng_signed_author(lt_user, msgsigned->author);
dateText += '\n' + tr::lng_signed_author(tr::now, lt_user, msgsigned->author);
}
}
return dateText;

View file

@ -62,7 +62,7 @@ not_null<HistoryItem*> CreateUnsupportedMessage(
UserId from) {
const auto siteLink = qsl("https://desktop.telegram.org");
auto text = TextWithEntities{
lng_message_unsupported(lt_link, siteLink)
tr::lng_message_unsupported(tr::now, lt_link, siteLink)
};
TextUtilities::ParseEntities(text, Ui::ItemTextNoMonoOptions().flags);
text.entities.push_front(
@ -748,8 +748,8 @@ QString HistoryItem::inDialogsText(DrawInDialog way) const {
}();
if (sender) {
auto fromText = sender->isSelf() ? tr::lng_from_you(tr::now) : sender->shortName();
auto fromWrapped = textcmdLink(1, lng_dialogs_text_from_wrapped(lt_from, TextUtilities::Clean(fromText)));
return lng_dialogs_text_with_from(lt_from_part, fromWrapped, lt_message, plainText);
auto fromWrapped = textcmdLink(1, tr::lng_dialogs_text_from_wrapped(tr::now, lt_from, TextUtilities::Clean(fromText)));
return tr::lng_dialogs_text_with_from(tr::now, lt_from_part, fromWrapped, lt_message, plainText);
}
return plainText;
}

View file

@ -29,7 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
void HistoryMessageVia::create(UserId userId) {
bot = Auth().data().user(userId);
maxWidth = st::msgServiceNameFont->width(
lng_inline_bot_via(lt_inline_bot, '@' + bot->username));
tr::lng_inline_bot_via(tr::now, lt_inline_bot, '@' + bot->username));
link = std::make_shared<LambdaClickHandler>([bot = this->bot] {
App::insertBotCommand('@' + bot->username);
});
@ -40,7 +40,7 @@ void HistoryMessageVia::resize(int32 availw) const {
text = QString();
width = 0;
} else {
text = lng_inline_bot_via(lt_inline_bot, '@' + bot->username);
text = tr::lng_inline_bot_via(tr::now, lt_inline_bot, '@' + bot->username);
if (availw < maxWidth) {
text = st::msgServiceNameFont->elided(text, availw);
width = st::msgServiceNameFont->width(text);
@ -102,7 +102,8 @@ void HistoryMessageForwarded::create(const HistoryMessageVia *via) const {
? App::peerName(originalSender)
: hiddenSenderInfo->name;
if (!originalAuthor.isEmpty()) {
phrase = lng_forwarded_signed(
phrase = tr::lng_forwarded_signed(
tr::now,
lt_channel,
name,
lt_user,
@ -112,13 +113,15 @@ void HistoryMessageForwarded::create(const HistoryMessageVia *via) const {
}
if (via) {
if (fromChannel) {
phrase = lng_forwarded_channel_via(
phrase = tr::lng_forwarded_channel_via(
tr::now,
lt_channel,
textcmdLink(1, phrase),
lt_inline_bot,
textcmdLink(2, '@' + via->bot->username));
} else {
phrase = lng_forwarded_via(
phrase = tr::lng_forwarded_via(
tr::now,
lt_user,
textcmdLink(1, phrase),
lt_inline_bot,
@ -126,11 +129,13 @@ void HistoryMessageForwarded::create(const HistoryMessageVia *via) const {
}
} else {
if (fromChannel) {
phrase = lng_forwarded_channel(
phrase = tr::lng_forwarded_channel(
tr::now,
lt_channel,
textcmdLink(1, phrase));
} else {
phrase = lng_forwarded(
phrase = tr::lng_forwarded(
tr::now,
lt_user,
textcmdLink(1, phrase));
}

View file

@ -42,15 +42,15 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
auto u = history()->owner().user(users[0].v);
if (u == _from) {
result.links.push_back(fromLink());
result.text = lng_action_user_joined(lt_from, fromLinkText());
result.text = tr::lng_action_user_joined(tr::now, lt_from, fromLinkText());
} else {
result.links.push_back(fromLink());
result.links.push_back(u->createOpenLink());
result.text = lng_action_add_user(lt_from, fromLinkText(), lt_user, textcmdLink(2, u->name));
result.text = tr::lng_action_add_user(tr::now, lt_from, fromLinkText(), lt_user, textcmdLink(2, u->name));
}
} else if (users.isEmpty()) {
result.links.push_back(fromLink());
result.text = lng_action_add_user(lt_from, fromLinkText(), lt_user, "somebody");
result.text = tr::lng_action_add_user(tr::now, lt_from, fromLinkText(), lt_user, qsl("somebody"));
} else {
result.links.push_back(fromLink());
for (auto i = 0, l = users.size(); i != l; ++i) {
@ -61,12 +61,12 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
if (i == 0) {
result.text = linkText;
} else if (i + 1 == l) {
result.text = lng_action_add_users_and_last(lt_accumulated, result.text, lt_user, linkText);
result.text = tr::lng_action_add_users_and_last(tr::now, lt_accumulated, result.text, lt_user, linkText);
} else {
result.text = lng_action_add_users_and_one(lt_accumulated, result.text, lt_user, linkText);
result.text = tr::lng_action_add_users_and_one(tr::now, lt_accumulated, result.text, lt_user, linkText);
}
}
result.text = lng_action_add_users_many(lt_from, fromLinkText(), lt_users, result.text);
result.text = tr::lng_action_add_users_many(tr::now, lt_from, fromLinkText(), lt_users, result.text);
}
return result;
};
@ -74,14 +74,14 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
auto prepareChatJoinedByLink = [this](const MTPDmessageActionChatJoinedByLink &action) {
auto result = PreparedText{};
result.links.push_back(fromLink());
result.text = lng_action_user_joined_by_link(lt_from, fromLinkText());
result.text = tr::lng_action_user_joined_by_link(tr::now, lt_from, fromLinkText());
return result;
};
auto prepareChatCreate = [this](const MTPDmessageActionChatCreate &action) {
auto result = PreparedText{};
result.links.push_back(fromLink());
result.text = lng_action_created_chat(lt_from, fromLinkText(), lt_title, TextUtilities::Clean(qs(action.vtitle)));
result.text = tr::lng_action_created_chat(tr::now, lt_from, fromLinkText(), lt_title, TextUtilities::Clean(qs(action.vtitle)));
return result;
};
@ -91,7 +91,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
result.text = tr::lng_action_created_channel(tr::now);
} else {
result.links.push_back(fromLink());
result.text = lng_action_created_chat(lt_from, fromLinkText(), lt_title, TextUtilities::Clean(qs(action.vtitle)));
result.text = tr::lng_action_created_chat(tr::now, lt_from, fromLinkText(), lt_title, TextUtilities::Clean(qs(action.vtitle)));
}
return result;
};
@ -102,7 +102,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
result.text = tr::lng_action_removed_photo_channel(tr::now);
} else {
result.links.push_back(fromLink());
result.text = lng_action_removed_photo(lt_from, fromLinkText());
result.text = tr::lng_action_removed_photo(tr::now, lt_from, fromLinkText());
}
return result;
};
@ -111,12 +111,12 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
auto result = PreparedText{};
if (peerFromUser(action.vuser_id) == _from->id) {
result.links.push_back(fromLink());
result.text = lng_action_user_left(lt_from, fromLinkText());
result.text = tr::lng_action_user_left(tr::now, lt_from, fromLinkText());
} else {
auto user = history()->owner().user(action.vuser_id.v);
result.links.push_back(fromLink());
result.links.push_back(user->createOpenLink());
result.text = lng_action_kick_user(lt_from, fromLinkText(), lt_user, textcmdLink(2, user->name));
result.text = tr::lng_action_kick_user(tr::now, lt_from, fromLinkText(), lt_user, textcmdLink(2, user->name));
}
return result;
};
@ -127,7 +127,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
result.text = tr::lng_action_changed_photo_channel(tr::now);
} else {
result.links.push_back(fromLink());
result.text = lng_action_changed_photo(lt_from, fromLinkText());
result.text = tr::lng_action_changed_photo(tr::now, lt_from, fromLinkText());
}
return result;
};
@ -135,10 +135,10 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
auto prepareChatEditTitle = [this](const MTPDmessageActionChatEditTitle &action) {
auto result = PreparedText{};
if (isPost()) {
result.text = lng_action_changed_title_channel(lt_title, TextUtilities::Clean(qs(action.vtitle)));
result.text = tr::lng_action_changed_title_channel(tr::now, lt_title, TextUtilities::Clean(qs(action.vtitle)));
} else {
result.links.push_back(fromLink());
result.text = lng_action_changed_title(lt_from, fromLinkText(), lt_title, TextUtilities::Clean(qs(action.vtitle)));
result.text = tr::lng_action_changed_title(tr::now, lt_from, fromLinkText(), lt_title, TextUtilities::Clean(qs(action.vtitle)));
}
return result;
};
@ -149,7 +149,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
result.text = tr::lng_action_you_took_screenshot(tr::now);
} else {
result.links.push_back(fromLink());
result.text = lng_action_took_screenshot(lt_from, fromLinkText());
result.text = tr::lng_action_took_screenshot(tr::now, lt_from, fromLinkText());
}
return result;
};
@ -163,7 +163,8 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
auto prepareBotAllowed = [&](const MTPDmessageActionBotAllowed &action) {
auto result = PreparedText{};
const auto domain = qs(action.vdomain);
result.text = lng_action_bot_allowed_from_domain(
result.text = tr::lng_action_bot_allowed_from_domain(
tr::now,
lt_domain,
textcmdLink(qstr("http://") + domain, domain));
return result;
@ -199,7 +200,8 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
}());
};
result.links.push_back(history()->peer->createOpenLink());
result.text = lng_action_secure_values_sent(
result.text = tr::lng_action_secure_values_sent(
tr::now,
lt_user,
textcmdLink(1, App::peerName(history()->peer)),
lt_documents,
@ -210,7 +212,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
auto prepareContactSignUp = [this] {
auto result = PreparedText{};
result.links.push_back(fromLink());
result.text = lng_action_user_registered(lt_from, fromLinkText());
result.text = tr::lng_action_user_registered(tr::now, lt_from, fromLinkText());
return result;
};
@ -386,17 +388,17 @@ HistoryService::PreparedText HistoryService::preparePinnedText() {
if (!limit && cutAt + 5 < size) {
original = original.mid(0, cutAt) + qstr("...");
}
result.text = lng_action_pinned_message(lt_from, fromLinkText(), lt_text, textcmdLink(2, original));
result.text = tr::lng_action_pinned_message(tr::now, lt_from, fromLinkText(), lt_text, textcmdLink(2, original));
} else {
result.text = lng_action_pinned_media(lt_from, fromLinkText(), lt_media, textcmdLink(2, mediaText));
result.text = tr::lng_action_pinned_media(tr::now, lt_from, fromLinkText(), lt_media, textcmdLink(2, mediaText));
}
} else if (pinned && pinned->msgId) {
result.links.push_back(fromLink());
result.links.push_back(pinned->lnk);
result.text = lng_action_pinned_media(lt_from, fromLinkText(), lt_media, textcmdLink(2, tr::lng_contacts_loading(tr::now)));
result.text = tr::lng_action_pinned_media(tr::now, lt_from, fromLinkText(), lt_media, textcmdLink(2, tr::lng_contacts_loading(tr::now)));
} else {
result.links.push_back(fromLink());
result.text = lng_action_pinned_media(lt_from, fromLinkText(), lt_media, tr::lng_deleted_message(tr::now));
result.text = tr::lng_action_pinned_media(tr::now, lt_from, fromLinkText(), lt_media, tr::lng_deleted_message(tr::now));
}
return result;
}
@ -431,11 +433,13 @@ HistoryService::PreparedText HistoryService::prepareGameScoreText() {
if (_from->isSelf()) {
auto gameTitle = computeGameTitle();
if (gameTitle.isEmpty()) {
result.text = lng_action_game_you_scored_no_game(
result.text = tr::lng_action_game_you_scored_no_game(
tr::now,
lt_count,
scoreNumber);
} else {
result.text = lng_action_game_you_scored(
result.text = tr::lng_action_game_you_scored(
tr::now,
lt_count,
scoreNumber,
lt_game,
@ -445,13 +449,15 @@ HistoryService::PreparedText HistoryService::prepareGameScoreText() {
result.links.push_back(fromLink());
auto gameTitle = computeGameTitle();
if (gameTitle.isEmpty()) {
result.text = lng_action_game_score_no_game(
result.text = tr::lng_action_game_score_no_game(
tr::now,
lt_count,
scoreNumber,
lt_from,
fromLinkText());
} else {
result.text = lng_action_game_score(
result.text = tr::lng_action_game_score(
tr::now,
lt_count,
scoreNumber,
lt_from,
@ -482,9 +488,9 @@ HistoryService::PreparedText HistoryService::preparePaymentSentText() {
}();
if (invoiceTitle.isEmpty()) {
result.text = lng_action_payment_done(lt_amount, payment->amount, lt_user, history()->peer->name);
result.text = tr::lng_action_payment_done(tr::now, lt_amount, payment->amount, lt_user, history()->peer->name);
} else {
result.text = lng_action_payment_done_for(lt_amount, payment->amount, lt_user, history()->peer->name, lt_invoice, invoiceTitle);
result.text = tr::lng_action_payment_done_for(tr::now, lt_amount, payment->amount, lt_user, history()->peer->name, lt_invoice, invoiceTitle);
}
return result;
}
@ -619,7 +625,7 @@ void HistoryService::createFromMtp(const MTPDmessage &message) {
} else {
auto result = PreparedText();
result.links.push_back(fromLink());
result.text = lng_ttl_photo_received(lt_from, fromLinkText());
result.text = tr::lng_ttl_photo_received(tr::now, lt_from, fromLinkText());
setServiceText(std::move(result));
}
} else {
@ -636,7 +642,7 @@ void HistoryService::createFromMtp(const MTPDmessage &message) {
} else {
auto result = PreparedText();
result.links.push_back(fromLink());
result.text = lng_ttl_video_received(lt_from, fromLinkText());
result.text = tr::lng_ttl_video_received(tr::now, lt_from, fromLinkText());
setServiceText(std::move(result));
}
} else {
@ -755,14 +761,18 @@ HistoryService::PreparedText GenerateJoinedText(
auto result = HistoryService::PreparedText{};
result.links.push_back(inviter->createOpenLink());
result.text = (history->isMegagroup()
? lng_action_add_you_group
: lng_action_add_you)(lt_from, textcmdLink(1, inviter->name));
? tr::lng_action_add_you_group
: tr::lng_action_add_you)(
tr::now,
lt_from,
textcmdLink(1, inviter->name));
return result;
} else if (history->isMegagroup()) {
auto self = history->session().user();
auto result = HistoryService::PreparedText{};
result.links.push_back(self->createOpenLink());
result.text = lng_action_user_joined(
result.text = tr::lng_action_user_joined(
tr::now,
lt_from,
textcmdLink(1, self->name));
return result;

View file

@ -3936,10 +3936,12 @@ bool HistoryWidget::showSendingFilesError(
case Error::None: return QString();
case Error::EmptyFile:
case Error::Directory:
case Error::NonLocalUrl: return lng_send_image_empty(
case Error::NonLocalUrl: return tr::lng_send_image_empty(
tr::now,
lt_name,
list.errorData);
case Error::TooLargeFile: return lng_send_image_too_large(
case Error::TooLargeFile: return tr::lng_send_image_too_large(
tr::now,
lt_name,
list.errorData);
}
@ -6252,17 +6254,17 @@ void HistoryWidget::updateForwardingTexts() {
}
}
if (names.size() > 2) {
from = lng_forwarding_from(lt_count, names.size() - 1, lt_user, names[0]);
from = tr::lng_forwarding_from(tr::now, lt_count, names.size() - 1, lt_user, names[0]);
} else if (names.size() < 2) {
from = fullname;
} else {
from = lng_forwarding_from_two(lt_user, names[0], lt_second_user, names[1]);
from = tr::lng_forwarding_from_two(tr::now, lt_user, names[0], lt_second_user, names[1]);
}
if (count < 2) {
text = _toForward.front()->inReplyText();
} else {
text = textcmdLink(1, lng_forward_messages(lt_count, count));
text = textcmdLink(1, tr::lng_forward_messages(tr::now, lt_count, count));
}
}
_toForwardFrom.setText(st::msgNameStyle, from, Ui::NameTextOptions());

View file

@ -36,7 +36,8 @@ HistoryCall::HistoryCall(
if (_duration) {
if (_reason != FinishReason::Missed
&& _reason != FinishReason::Busy) {
_status = lng_call_duration_info(
_status = tr::lng_call_duration_info(
tr::now,
lt_time,
_status,
lt_duration,

View file

@ -73,7 +73,7 @@ HistoryContact::HistoryContact(
_name.setText(
st::semiboldTextStyle,
lng_full_name(lt_first_name, first, lt_last_name, last).trimmed(),
tr::lng_full_name(tr::now, lt_first_name, first, lt_last_name, last).trimmed(),
Ui::NameTextOptions());
_phonew = st::normalFont->width(_phone);
}

View file

@ -810,7 +810,7 @@ TextState HistoryPoll::textState(QPoint point, StateRequest request) const {
using Flag = Ui::Text::StateRequest::Flag;
if (request.flags & Flag::LookupCustomTooltip) {
result.customTooltipText = answer.votes
? lng_polls_votes_count(lt_count_decimal, answer.votes)
? tr::lng_polls_votes_count(tr::now, lt_count_decimal, answer.votes)
: tr::lng_polls_votes_none(tr::now);
}
}

View file

@ -86,7 +86,7 @@ void ContactStatus::Bar::showState(State state) {
_share->setVisible(state == State::SharePhoneNumber);
_report->setVisible(state == State::ReportSpam);
_add->setText((state == State::Add)
? lng_new_contact_add_name(lt_user, _name).toUpper()
? tr::lng_new_contact_add_name(tr::now, lt_user, _name).toUpper()
: tr::lng_new_contact_add(tr::now).toUpper());
updateButtonsGeometry();
}
@ -317,7 +317,7 @@ void ContactStatus::setupShareHandler(not_null<UserData*> user) {
user->session().api().applyUpdates(result);
Ui::Toast::Show(
lng_new_contact_share_done(lt_user, user->shortName()));
tr::lng_new_contact_share_done(tr::now, lt_user, user->shortName()));
}).send();
}, _bar.lifetime());
}

View file

@ -119,7 +119,7 @@ void UnreadBar::init(int newCount) {
count = newCount;
text = /*(count == kCountUnknown) // #feed
? tr::lng_unread_bar_some(tr::now)
: */lng_unread_bar(lt_count, count);
: */tr::lng_unread_bar(tr::now, lt_count, count);
width = st::semiboldFont->width(text);
}

View file

@ -771,7 +771,7 @@ void TopBarWidget::updateOnlineDisplay() {
} else if (chat->count <= 0) {
text = tr::lng_group_status(tr::now);
} else {
text = lng_chat_status_members(lt_count_decimal, chat->count);
text = tr::lng_chat_status_members(tr::now, lt_count_decimal, chat->count);
}
} else {
const auto self = Auth().user();
@ -784,11 +784,11 @@ void TopBarWidget::updateOnlineDisplay() {
}
}
if (online > 0 && !onlyMe) {
auto membersCount = lng_chat_status_members(lt_count_decimal, chat->participants.size());
auto onlineCount = lng_chat_status_online(lt_count, online);
text = lng_chat_status_members_online(lt_members_count, membersCount, lt_online_count, onlineCount);
auto membersCount = tr::lng_chat_status_members(tr::now, lt_count_decimal, chat->participants.size());
auto onlineCount = tr::lng_chat_status_online(tr::now, lt_count, online);
text = tr::lng_chat_status_members_online(tr::now, lt_members_count, membersCount, lt_online_count, onlineCount);
} else if (chat->participants.size() > 0) {
text = lng_chat_status_members(lt_count_decimal, chat->participants.size());
text = tr::lng_chat_status_members(tr::now, lt_count_decimal, chat->participants.size());
} else {
text = tr::lng_group_status(tr::now);
}
@ -810,16 +810,16 @@ void TopBarWidget::updateOnlineDisplay() {
}
}
if (online && !onlyMe) {
auto membersCount = lng_chat_status_members(lt_count_decimal, channel->membersCount());
auto onlineCount = lng_chat_status_online(lt_count, online);
text = lng_chat_status_members_online(lt_members_count, membersCount, lt_online_count, onlineCount);
auto membersCount = tr::lng_chat_status_members(tr::now, lt_count_decimal, channel->membersCount());
auto onlineCount = tr::lng_chat_status_online(tr::now, lt_count, online);
text = tr::lng_chat_status_members_online(tr::now, lt_members_count, membersCount, lt_online_count, onlineCount);
} else if (channel->membersCount() > 0) {
text = lng_chat_status_members(lt_count_decimal, channel->membersCount());
text = tr::lng_chat_status_members(tr::now, lt_count_decimal, channel->membersCount());
} else {
text = tr::lng_group_status(tr::now);
}
} else if (channel->membersCount() > 0) {
text = lng_chat_status_members(lt_count_decimal, channel->membersCount());
text = tr::lng_chat_status_members(tr::now, lt_count_decimal, channel->membersCount());
} else {
text = channel->isMegagroup() ? tr::lng_group_status(tr::now) : tr::lng_channel_status(tr::now);

View file

@ -27,21 +27,21 @@ namespace Media {
using Type = Storage::SharedMediaType;
inline auto MediaTextPhrase(Type type) {
inline tr::phrase<lngtag_count> MediaTextPhrase(Type type) {
switch (type) {
case Type::Photo: return lng_profile_photos;
case Type::Video: return lng_profile_videos;
case Type::File: return lng_profile_files;
case Type::MusicFile: return lng_profile_songs;
case Type::Link: return lng_profile_shared_links;
case Type::RoundVoiceFile: return lng_profile_audios;
case Type::Photo: return tr::lng_profile_photos;
case Type::Video: return tr::lng_profile_videos;
case Type::File: return tr::lng_profile_files;
case Type::MusicFile: return tr::lng_profile_songs;
case Type::Link: return tr::lng_profile_shared_links;
case Type::RoundVoiceFile: return tr::lng_profile_audios;
}
Unexpected("Type in MediaTextPhrase()");
};
inline auto MediaText(Type type) {
return [phrase = MediaTextPhrase(type)](int count) {
return phrase(lt_count, count);
return phrase(tr::now, lt_count, count);
};
}
@ -106,7 +106,7 @@ inline auto AddCommonGroupsButton(
parent,
Profile::CommonGroupsCountValue(user),
[](int count) {
return lng_profile_common_groups(lt_count, count);
return tr::lng_profile_common_groups(tr::now, lt_count, count);
},
tracker)->entity();
result->addClickHandler([=] {

View file

@ -812,12 +812,10 @@ object_ptr<Ui::RpWidget> SetupChannelMembers(
channel,
MTPDchannelFull::Flag::f_can_view_participants),
(_1 > 0) && _2);
auto membersText = MembersCountValue(
channel
) | rpl::map([](int count) {
return lng_chat_status_members(lt_count_decimal, count);
});
auto membersCallback = [controller, channel] {
auto membersText = tr::lng_chat_status_members(
lt_count_decimal,
MembersCountValue(channel) | tr::to_count());
auto membersCallback = [=] {
controller->showSection(Info::Memento(
channel->id,
Section::Type::Members));

View file

@ -127,11 +127,11 @@ bool SectionToggle::checkRippleStartPosition(QPoint position) const {
}
auto MembersStatusText(int count) {
return lng_chat_status_members(lt_count_decimal, count);
return tr::lng_chat_status_members(tr::now, lt_count_decimal, count);
};
auto OnlineStatusText(int count) {
return lng_chat_status_online(lt_count_decimal, count);
return tr::lng_chat_status_online(tr::now, lt_count_decimal, count);
};
auto ChatStatusText(int fullCount, int onlineCount, bool isGroup) {

View file

@ -164,11 +164,11 @@ void Members::setupHeader() {
object_ptr<Ui::FlatLabel> Members::setupTitle() {
auto result = object_ptr<Ui::FlatLabel>(
_titleWrap,
MembersCountValue(
_peer
) | rpl::map([](int count) {
return lng_chat_status_members(lt_count_decimal, count);
}) | Ui::Text::ToUpper(),
tr::lng_chat_status_members(
lt_count_decimal,
MembersCountValue(_peer) | tr::to_count(),
Ui::Text::Upper
),
st::infoBlockHeaderLabel);
result->setAttribute(Qt::WA_TransparentForMouseEvents);
return result;

View file

@ -128,13 +128,27 @@ void CodeWidget::updateCallText() {
switch (_callStatus) {
case Widget::Data::CallStatus::Waiting: {
if (_callTimeout >= 3600) {
return lng_code_call(lt_minutes, qsl("%1:%2").arg(_callTimeout / 3600).arg((_callTimeout / 60) % 60, 2, 10, QChar('0')), lt_seconds, qsl("%1").arg(_callTimeout % 60, 2, 10, QChar('0')));
return tr::lng_code_call(
tr::now,
lt_minutes,
qsl("%1:%2"
).arg(_callTimeout / 3600
).arg((_callTimeout / 60) % 60, 2, 10, QChar('0')),
lt_seconds,
qsl("%1").arg(_callTimeout % 60, 2, 10, QChar('0')));
} else {
return lng_code_call(lt_minutes, QString::number(_callTimeout / 60), lt_seconds, qsl("%1").arg(_callTimeout % 60, 2, 10, QChar('0')));
return tr::lng_code_call(
tr::now,
lt_minutes,
QString::number(_callTimeout / 60),
lt_seconds,
qsl("%1").arg(_callTimeout % 60, 2, 10, QChar('0')));
}
} break;
case Widget::Data::CallStatus::Calling: return tr::lng_code_calling(tr::now);
case Widget::Data::CallStatus::Called: return tr::lng_code_called(tr::now);
case Widget::Data::CallStatus::Calling:
return tr::lng_code_calling(tr::now);
case Widget::Data::CallStatus::Called:
return tr::lng_code_called(tr::now);
}
return QString();
})();

View file

@ -52,7 +52,8 @@ PwdCheckWidget::PwdCheckWidget(
if (_hint.isEmpty()) {
_pwdHint->hide();
} else {
_pwdHint->setText(lng_signin_hint(lt_password_hint, _hint));
_pwdHint->setText(
tr::lng_signin_hint(tr::now, lt_password_hint, _hint));
}
_codeField->hide();
_toPassword->hide();
@ -61,10 +62,16 @@ PwdCheckWidget::PwdCheckWidget(
}
void PwdCheckWidget::refreshLang() {
if (_toRecover) _toRecover->setText(tr::lng_signin_recover(tr::now));
if (_toPassword) _toPassword->setText(tr::lng_signin_try_password(tr::now));
if (_toRecover) {
_toRecover->setText(tr::lng_signin_recover(tr::now));
}
if (_toPassword) {
_toPassword->setText(
tr::lng_signin_try_password(tr::now));
}
if (!_hint.isEmpty()) {
_pwdHint->setText(lng_signin_hint(lt_password_hint, _hint));
_pwdHint->setText(
tr::lng_signin_hint(tr::now, lt_password_hint, _hint));
}
updateControlsGeometry();
}

View file

@ -373,22 +373,52 @@ void Widget::resetAccount() {
auto type = error.type();
if (type.startsWith(qstr("2FA_CONFIRM_WAIT_"))) {
auto seconds = type.mid(qstr("2FA_CONFIRM_WAIT_").size()).toInt();
auto days = (seconds + 59) / 86400;
auto hours = ((seconds + 59) % 86400) / 3600;
auto minutes = ((seconds + 59) % 3600) / 60;
auto when = lng_signin_reset_minutes(lt_count, minutes);
const auto seconds = type.mid(qstr("2FA_CONFIRM_WAIT_").size()).toInt();
const auto days = (seconds + 59) / 86400;
const auto hours = ((seconds + 59) % 86400) / 3600;
const auto minutes = ((seconds + 59) % 3600) / 60;
auto when = tr::lng_signin_reset_minutes(
tr::now,
lt_count,
minutes);
if (days > 0) {
auto daysCount = lng_signin_reset_days(lt_count, days);
auto hoursCount = lng_signin_reset_hours(lt_count, hours);
when = lng_signin_reset_in_days(lt_days_count, daysCount, lt_hours_count, hoursCount, lt_minutes_count, when);
const auto daysCount = tr::lng_signin_reset_days(
tr::now,
lt_count,
days);
const auto hoursCount = tr::lng_signin_reset_hours(
tr::now,
lt_count,
hours);
when = tr::lng_signin_reset_in_days(
tr::now,
lt_days_count,
daysCount,
lt_hours_count,
hoursCount,
lt_minutes_count,
when);
} else if (hours > 0) {
auto hoursCount = lng_signin_reset_hours(lt_count, hours);
when = lng_signin_reset_in_hours(lt_hours_count, hoursCount, lt_minutes_count, when);
const auto hoursCount = tr::lng_signin_reset_hours(
tr::now,
lt_count,
hours);
when = tr::lng_signin_reset_in_hours(
tr::now,
lt_hours_count,
hoursCount,
lt_minutes_count,
when);
}
Ui::show(Box<InformBox>(lng_signin_reset_wait(lt_phone_number, App::formatPhone(getData()->phone), lt_when, when)));
Ui::show(Box<InformBox>(tr::lng_signin_reset_wait(
tr::now,
lt_phone_number,
App::formatPhone(getData()->phone),
lt_when,
when)));
} else if (type == qstr("2FA_RECENT_CONFIRM")) {
Ui::show(Box<InformBox>(tr::lng_signin_reset_cancelled(tr::now)));
Ui::show(Box<InformBox>(
tr::lng_signin_reset_cancelled(tr::now)));
} else {
Ui::hideLayer();
getStep()->showError(rpl::single(Lang::Hard::ServerError()));

View file

@ -12,20 +12,27 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace {
template <typename WithYear, typename WithoutYear>
inline QString langDateMaybeWithYear(QDate date, WithYear withYear, WithoutYear withoutYear) {
auto month = date.month();
inline QString langDateMaybeWithYear(
QDate date,
WithYear withYear,
WithoutYear withoutYear) {
const auto month = date.month();
if (month <= 0 || month > 12) {
return qsl("MONTH_ERR");
};
auto year = date.year();
auto current = QDate::currentDate();
auto currentYear = current.year();
auto currentMonth = current.month();
const auto year = date.year();
const auto current = QDate::currentDate();
const auto currentYear = current.year();
const auto currentMonth = current.month();
if (year != currentYear) {
auto yearIsMuchGreater = [](int year, int otherYear) {
const auto yearIsMuchGreater = [](int year, int otherYear) {
return (year > otherYear + 1);
};
auto monthIsMuchGreater = [](int year, int month, int otherYear, int otherMonth) {
const auto monthIsMuchGreater = [](
int year,
int month,
int otherYear,
int otherMonth) {
return (year == otherYear + 1) && (month + 12 > otherMonth + 3);
};
if (false
@ -123,23 +130,54 @@ bool langFirstNameGoesSecond() {
QString langDayOfMonth(const QDate &date) {
auto day = date.day();
return langDateMaybeWithYear(date, [&](int month, int year) {
return lng_month_day_year(lt_month, MonthSmall(month)(tr::now), lt_day, QString::number(day), lt_year, QString::number(year));
return tr::lng_month_day_year(
tr::now,
lt_month,
MonthSmall(month)(tr::now),
lt_day,
QString::number(day),
lt_year,
QString::number(year));
}, [day](int month, int year) {
return lng_month_day(lt_month, MonthSmall(month)(tr::now), lt_day, QString::number(day));
return tr::lng_month_day(
tr::now,
lt_month,
MonthSmall(month)(tr::now),
lt_day,
QString::number(day));
});
}
QString langDayOfMonthFull(const QDate &date) {
auto day = date.day();
return langDateMaybeWithYear(date, [day](int month, int year) {
return lng_month_day_year(lt_month, MonthDay(month)(tr::now), lt_day, QString::number(day), lt_year, QString::number(year));
return tr::lng_month_day_year(
tr::now,
lt_month,
MonthDay(month)(tr::now),
lt_day,
QString::number(day),
lt_year,
QString::number(year));
}, [day](int month, int year) {
return lng_month_day(lt_month, MonthDay(month)(tr::now), lt_day, QString::number(day));
return tr::lng_month_day(
tr::now,
lt_month,
MonthDay(month)(tr::now),
lt_day,
QString::number(day));
});
}
QString langMonthOfYear(int month, int year) {
return (month > 0 && month <= 12) ? lng_month_year(lt_month, MonthSmall(month)(tr::now), lt_year, QString::number(year)) : qsl("MONTH_ERR");
return (month > 0 && month <= 12)
? tr::lng_month_year(
tr::now,
lt_month,
MonthSmall(month)(tr::now),
lt_year,
QString::number(year))
: qsl("MONTH_ERR");
}
QString langMonth(const QDate &date) {
@ -151,7 +189,14 @@ QString langMonth(const QDate &date) {
}
QString langMonthOfYearFull(int month, int year) {
return (month > 0 && month <= 12) ? lng_month_year(lt_month, Month(month)(tr::now), lt_year, QString::number(year)) : qsl("MONTH_ERR");
return (month > 0 && month <= 12)
? tr::lng_month_year(
tr::now,
lt_month,
Month(month)(tr::now),
lt_year,
QString::number(year))
: qsl("MONTH_ERR");
}
QString langMonthFull(const QDate &date) {

View file

@ -23,11 +23,21 @@ inline QString langDayOfWeek(const QDate &date) {
}
inline QString langDateTime(const QDateTime &date) {
return lng_mediaview_date_time(lt_date, langDayOfMonth(date.date()), lt_time, date.time().toString(cTimeFormat()));
return tr::lng_mediaview_date_time(
tr::now,
lt_date,
langDayOfMonth(date.date()),
lt_time,
date.time().toString(cTimeFormat()));
}
inline QString langDateTimeFull(const QDateTime &date) {
return lng_mediaview_date_time(lt_date, langDayOfMonthFull(date.date()), lt_time, date.time().toString(cTimeFormat()));
return tr::lng_mediaview_date_time(
tr::now,
lt_date,
langDayOfMonthFull(date.date()),
lt_time,
date.time().toString(cTimeFormat()));
}
bool langFirstNameGoesSecond();

View file

@ -48,7 +48,7 @@ QString formatDownloadText(qint64 ready, qint64 total) {
totalStr = QString::number(total);
mb = qsl("B");
}
return lng_save_downloaded(lt_ready, readyStr, lt_total, totalStr, lt_mb, mb);
return tr::lng_save_downloaded(tr::now, lt_ready, readyStr, lt_total, totalStr, lt_mb, mb);
}
QString formatDurationText(qint64 duration) {
@ -59,24 +59,24 @@ QString formatDurationText(qint64 duration) {
QString formatDurationWords(qint64 duration) {
if (duration > 59) {
auto minutes = (duration / 60);
auto minutesCount = lng_duration_minsec_minutes(lt_count, minutes);
auto minutesCount = tr::lng_duration_minsec_minutes(tr::now, lt_count, minutes);
auto seconds = (duration % 60);
auto secondsCount = lng_duration_minsec_seconds(lt_count, seconds);
return lng_duration_minutes_seconds(lt_minutes_count, minutesCount, lt_seconds_count, secondsCount);
auto secondsCount = tr::lng_duration_minsec_seconds(tr::now, lt_count, seconds);
return tr::lng_duration_minutes_seconds(tr::now, lt_minutes_count, minutesCount, lt_seconds_count, secondsCount);
}
return lng_duration_seconds(lt_count, duration);
return tr::lng_duration_seconds(tr::now, lt_count, duration);
}
QString formatDurationAndSizeText(qint64 duration, qint64 size) {
return lng_duration_and_size(lt_duration, formatDurationText(duration), lt_size, formatSizeText(size));
return tr::lng_duration_and_size(tr::now, lt_duration, formatDurationText(duration), lt_size, formatSizeText(size));
}
QString formatGifAndSizeText(qint64 size) {
return lng_duration_and_size(lt_duration, qsl("GIF"), lt_size, formatSizeText(size));
return tr::lng_duration_and_size(tr::now, lt_duration, qsl("GIF"), lt_size, formatSizeText(size));
}
QString formatPlayedText(qint64 played, qint64 duration) {
return lng_duration_played(lt_played, formatDurationText(played), lt_duration, formatDurationText(duration));
return tr::lng_duration_played(tr::now, lt_played, formatDurationText(played), lt_duration, formatDurationText(duration));
}
int32 documentColorIndex(DocumentData *document, QString &ext) {

View file

@ -920,7 +920,7 @@ bool MainWidget::sendMessageFail(const RPCError &error) {
const auto link = textcmdLink(
Core::App().createInternalLinkFull(qsl("spambot")),
tr::lng_cant_more_info(tr::now));
const auto text = lng_error_public_groups_denied(lt_more_info, link);
const auto text = tr::lng_error_public_groups_denied(tr::now, lt_more_info, link);
Ui::show(Box<InformBox>(text));
return true;
}
@ -934,7 +934,7 @@ void MainWidget::cacheBackground() {
auto &bg = Window::Theme::Background()->pixmapForTiled();
auto result = QImage(_willCacheFor.width() * cIntRetinaFactor(), _willCacheFor.height() * cIntRetinaFactor(), QImage::Format_RGB32);
result.setDevicePixelRatio(cRetinaFactor());
result.setDevicePixelRatio(cRetinaFactor());
{
QPainter p(&result);
auto left = 0;
@ -3353,7 +3353,7 @@ bool MainWidget::usernameResolveFail(QString name, const RPCError &error) {
if (MTP::isDefaultHandledError(error)) return false;
if (error.code() == 400) {
Ui::show(Box<InformBox>(lng_username_not_found(lt_user, name)));
Ui::show(Box<InformBox>(tr::lng_username_not_found(tr::now, lt_user, name)));
}
return true;
}

View file

@ -522,11 +522,18 @@ void Widget::handleSongChange() {
const auto time = parsed.time().toString(cTimeFormat());
const auto today = QDateTime::currentDateTime().date();
if (date == today) {
return lng_player_message_today(lt_time, time);
return tr::lng_player_message_today(
tr::now,
lt_time,
time);
} else if (date.addDays(1) == today) {
return lng_player_message_yesterday(lt_time, time);
return tr::lng_player_message_yesterday(
tr::now,
lt_time,
time);
}
return lng_player_message_date(
return tr::lng_player_message_date(
tr::now,
lt_date,
langDayOfMonthFull(date),
lt_time,

View file

@ -499,7 +499,7 @@ void OverlayWidget::updateDocSize() {
totalStr = QString::number(total);
mb = qsl("B");
}
_docSize = lng_media_save_progress(lt_ready, readyStr, lt_total, totalStr, lt_mb, mb);
_docSize = tr::lng_media_save_progress(tr::now, lt_ready, readyStr, lt_total, totalStr, lt_mb, mb);
} else {
_docSize = formatSizeText(_doc->size);
}
@ -579,11 +579,11 @@ void OverlayWidget::updateControls() {
return dNow;
}();
if (d.date() == dNow.date()) {
_dateText = lng_mediaview_today(lt_time, d.time().toString(cTimeFormat()));
_dateText = tr::lng_mediaview_today(tr::now, lt_time, d.time().toString(cTimeFormat()));
} else if (d.date().addDays(1) == dNow.date()) {
_dateText = lng_mediaview_yesterday(lt_time, d.time().toString(cTimeFormat()));
_dateText = tr::lng_mediaview_yesterday(tr::now, lt_time, d.time().toString(cTimeFormat()));
} else {
_dateText = lng_mediaview_date_time(lt_date, d.date().toString(qsl("dd.MM.yy")), lt_time, d.time().toString(cTimeFormat()));
_dateText = tr::lng_mediaview_date_time(tr::now, lt_date, d.date().toString(qsl("dd.MM.yy")), lt_time, d.time().toString(cTimeFormat()));
}
if (!_fromName.isEmpty()) {
_fromNameLabel.setText(st::mediaviewTextStyle, _fromName, Ui::NameTextOptions());

View file

@ -186,7 +186,8 @@ void PlaybackControls::setLoadingProgress(int ready, int total) {
const auto percent = int(std::round(progress * 100));
if (_loadingPercent != percent) {
_loadingPercent = percent;
_downloadProgress->setText(lng_mediaview_video_loading(
_downloadProgress->setText(tr::lng_mediaview_video_loading(
tr::now,
lt_percent,
QString::number(percent) + '%'));
if (_playbackSlider->width() > _downloadProgress->width()) {

View file

@ -595,7 +595,8 @@ Voice::Voice(
TextParseOptions opts = { TextParseRichText, 0, 0, Qt::LayoutDirectionAuto };
_details.setText(
st::defaultTextStyle,
lng_date_and_duration(
tr::lng_date_and_duration(
tr::now,
lt_date,
dateText,
lt_duration,
@ -821,9 +822,9 @@ void Voice::updateName() {
auto version = 0;
if (const auto forwarded = parent()->Get<HistoryMessageForwarded>()) {
if (parent()->fromOriginal()->isChannel()) {
_name.setText(st::semiboldTextStyle, lng_forwarded_channel(lt_channel, App::peerName(parent()->fromOriginal())), Ui::NameTextOptions());
_name.setText(st::semiboldTextStyle, tr::lng_forwarded_channel(tr::now, lt_channel, App::peerName(parent()->fromOriginal())), Ui::NameTextOptions());
} else {
_name.setText(st::semiboldTextStyle, lng_forwarded(lt_user, App::peerName(parent()->fromOriginal())), Ui::NameTextOptions());
_name.setText(st::semiboldTextStyle, tr::lng_forwarded(tr::now, lt_user, App::peerName(parent()->fromOriginal())), Ui::NameTextOptions());
}
} else {
_name.setText(st::semiboldTextStyle, App::peerName(parent()->from()), Ui::NameTextOptions());

View file

@ -310,7 +310,8 @@ ScopeRow DocumentsOneOfRow(
const auto type1 = documents.front()->type;
const auto type2 = documents.back()->type;
return {
lng_passport_or_title(
tr::lng_passport_or_title(
tr::now,
lt_document,
DocumentName(type1),
lt_second_document,

View file

@ -44,7 +44,8 @@ ScanInfo CollectScanInfo(const EditFile &file) {
file.fields.downloadOffset,
file.fields.size);
} else {
return lng_passport_scan_uploaded(
return tr::lng_passport_scan_uploaded(
tr::now,
lt_date,
langDateTimeFull(ParseDateTime(file.fields.date)));
}
@ -56,7 +57,8 @@ ScanInfo CollectScanInfo(const EditFile &file) {
file.uploadData->offset,
file.uploadData->bytes.size());
} else {
return lng_passport_scan_uploaded(
return tr::lng_passport_scan_uploaded(
tr::now,
lt_date,
langDateTimeFull(ParseDateTime(file.fields.date)));
}
@ -301,7 +303,8 @@ EditDocumentScheme GetDocumentScheme(
const auto language = languageValue(countryCode);
return language.isEmpty()
? tr::lng_passport_native_name_title(tr::now)
: lng_passport_native_name_language(
: tr::lng_passport_native_name_language(
tr::now,
lt_language,
language);
};
@ -312,7 +315,8 @@ EditDocumentScheme GetDocumentScheme(
}
const auto name = CountrySelectBox::NameByISO(countryCode);
Assert(!name.isEmpty());
return lng_passport_native_name_about(
return tr::lng_passport_native_name_about(
tr::now,
lt_country,
name);
};

View file

@ -392,7 +392,10 @@ object_ptr<BoxContent> VerifyPhoneBox(
rpl::producer<QString> error) {
return Box<VerifyBox>(
tr::lng_passport_phone_title(),
lng_passport_confirm_phone(lt_phone, App::formatPhone(phone)),
tr::lng_passport_confirm_phone(
tr::now,
lt_phone,
App::formatPhone(phone)),
codeLength,
submit,
nullptr,
@ -410,7 +413,7 @@ object_ptr<BoxContent> VerifyEmailBox(
rpl::producer<QString> resent) {
return Box<VerifyBox>(
tr::lng_passport_email_title(),
lng_passport_confirm_email(lt_email, email),
tr::lng_passport_confirm_email(tr::now, lt_email, email),
codeLength,
submit,
resend,

View file

@ -272,7 +272,7 @@ void EditScans::List::pushScan(const ScanInfo &info) {
rows.push_back(CreateScan(
wrap,
info,
lng_passport_scan_index(lt_index, QString::number(index + 1))));
tr::lng_passport_scan_index(tr::now, lt_index, QString::number(index + 1))));
rows.back()->hide(anim::type::instant);
const auto scan = rows.back()->entity();

View file

@ -232,7 +232,7 @@ not_null<Ui::RpWidget*> PanelForm::setupContent() {
inner,
object_ptr<Ui::FlatLabel>(
inner,
lng_passport_request1(lt_bot, App::peerName(bot)),
tr::lng_passport_request1(tr::now, lt_bot, App::peerName(bot)),
st::passportPasswordLabelBold)),
st::passportFormAbout1Padding)->entity();

View file

@ -35,7 +35,10 @@ PanelAskPassword::PanelAskPassword(
st::passportPasswordUserpic)
, _about1(
this,
lng_passport_request1(lt_bot, App::peerName(_controller->bot())),
tr::lng_passport_request1(
tr::now,
lt_bot,
App::peerName(_controller->bot())),
st::passportPasswordLabelBold)
, _about2(
this,
@ -173,7 +176,8 @@ void PanelNoPassword::setupContent() {
_inner,
object_ptr<Ui::FlatLabel>(
_inner,
lng_passport_request1(
tr::lng_passport_request1(
tr::now,
lt_bot,
App::peerName(_controller->bot())),
st::passportPasswordLabelBold)),
@ -221,7 +225,7 @@ void PanelNoPassword::refreshBottom() {
_inner,
(pattern.isEmpty()
? tr::lng_passport_about_password(tr::now)
: lng_passport_code_sent(lt_email, pattern)),
: tr::lng_passport_code_sent(tr::now, lt_email, pattern)),
st::passportPasswordSetupLabel)),
st::passportFormAbout2Padding)->entity());
if (pattern.isEmpty()) {

View file

@ -469,7 +469,7 @@ bool UnsafeShowOpenWith(const QString &filepath) {
[button setHidden:YES];
#endif // OS_MAC_STORE
NSTextField *goodLabel = [[NSTextField alloc] init];
[goodLabel setStringValue:Q2NSString(lng_mac_this_app_can_open(lt_file, NS2QString(name)))];
[goodLabel setStringValue:Q2NSString(tr::lng_mac_this_app_can_open(tr::now, lt_file, NS2QString(name)))];
[goodLabel setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
[goodLabel setBezeled:NO];
[goodLabel setDrawsBackground:NO];
@ -482,7 +482,7 @@ bool UnsafeShowOpenWith(const QString &filepath) {
[goodLabel setFrame:goodFrame];
NSTextField *badLabel = [[NSTextField alloc] init];
[badLabel setStringValue:Q2NSString(lng_mac_not_known_app(lt_file, NS2QString(name)))];
[badLabel setStringValue:Q2NSString(tr::lng_mac_not_known_app(tr::now, lt_file, NS2QString(name)))];
[badLabel setFont:[goodLabel font]];
[badLabel setBezeled:NO];
[badLabel setDrawsBackground:NO];

View file

@ -639,7 +639,7 @@ void MainWindow::psFirstShow() {
void MainWindow::createGlobalMenu() {
auto main = psMainMenu.addMenu(qsl("Telegram"));
auto about = main->addAction(lng_mac_menu_about_telegram(lt_telegram, qsl("Telegram")));
auto about = main->addAction(tr::lng_mac_menu_about_telegram(tr::now, lt_telegram, qsl("Telegram")));
connect(about, &QAction::triggered, about, [] {
if (App::wnd() && App::wnd()->isHidden()) App::wnd()->showFromTray();
Ui::show(Box<AboutBox>());

View file

@ -772,7 +772,7 @@ void MainWindow::updateIconCounters() {
iconOverlay.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(-32, counter, bg, fg, false)));
ps_iconOverlay = createHIconFromQIcon(iconOverlay, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON));
}
auto description = (counter > 0) ? lng_unread_bar(lt_count, counter) : QString();
auto description = (counter > 0) ? tr::lng_unread_bar(tr::now, lt_count, counter) : QString();
taskbarList->SetOverlayIcon(ps_hWnd, ps_iconOverlay, description.toStdWString().c_str());
}
SetWindowPos(ps_hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);

View file

@ -72,7 +72,7 @@ void GroupMembersWidget::removePeer(PeerData *selectedPeer) {
auto user = selectedPeer->asUser();
Assert(user != nullptr);
auto text = lng_profile_sure_kick(lt_user, user->firstName);
auto text = tr::lng_profile_sure_kick(tr::now, lt_user, user->firstName);
auto currentRestrictedRights = [&]() -> MTPChatBannedRights {
if (auto channel = peer()->asMegagroup()) {
auto it = channel->mgInfo->lastRestricted.find(user);

View file

@ -48,11 +48,11 @@ void SetupConnectionType(not_null<Ui::VerticalLayout*> container) {
if (Global::ProxySettings() != ProxyData::Settings::Enabled) {
return transport.isEmpty()
? tr::lng_connection_auto_connecting(tr::now)
: lng_connection_auto(lt_transport, transport);
: tr::lng_connection_auto(tr::now, lt_transport, transport);
} else {
return transport.isEmpty()
? tr::lng_connection_proxy_connecting(tr::now)
: lng_connection_proxy(lt_transport, transport);
: tr::lng_connection_proxy(tr::now, lt_transport, transport);
}
};
const auto button = AddButtonWithLabel(
@ -83,7 +83,8 @@ void SetupUpdate(not_null<Ui::VerticalLayout*> container) {
container.get());
const auto downloading = Ui::CreateChild<rpl::event_stream<bool>>(
container.get());
const auto version = lng_settings_current_version(
const auto version = tr::lng_settings_current_version(
tr::now,
lt_version,
currentVersionText());
const auto toggle = AddButton(
@ -130,7 +131,8 @@ void SetupUpdate(not_null<Ui::VerticalLayout*> container) {
label->setAttribute(Qt::WA_TransparentForMouseEvents);
const auto showDownloadProgress = [=](int64 ready, int64 total) {
texts->fire(lng_settings_downloading_update(
texts->fire(tr::lng_settings_downloading_update(
tr::now,
lt_progress,
formatDownloadText(ready, total)));
downloading->fire(true);

View file

@ -150,7 +150,7 @@ void Calls::setupContent() {
const auto updateOutputLabel = [=](int value) {
const auto percent = QString::number(value);
outputLabel->setText(
lng_settings_call_output_volume(lt_percent, percent));
tr::lng_settings_call_output_volume(tr::now, lt_percent, percent));
};
const auto updateOutputVolume = [=](int value) {
_needWriteSettings = true;
@ -228,7 +228,7 @@ void Calls::setupContent() {
const auto updateInputLabel = [=](int value) {
const auto percent = QString::number(value);
inputLabel->setText(
lng_settings_call_input_volume(lt_percent, percent));
tr::lng_settings_call_input_volume(tr::now, lt_percent, percent));
};
const auto updateInputVolume = [=](int value) {
_needWriteSettings = true;

View file

@ -675,7 +675,8 @@ void ForwardsPrivacyController::PaintForwardedTooltip(
const auto innerWidth = bubbleWidth
- st::msgPadding.left()
- st::msgPadding.right();
const auto phrase = lng_forwarded(
const auto phrase = tr::lng_forwarded(
tr::now,
lt_user,
App::peerName(view->data()->history()->session().user()));
const auto kReplacementPosition = QChar(0x0001);

View file

@ -218,8 +218,8 @@ void SetupLocalPasscode(not_null<Ui::VerticalLayout*> container) {
) | rpl::map([] {
const auto autolock = Global::AutoLock();
return (autolock % 3600)
? lng_passcode_autolock_minutes(lt_count, autolock / 60)
: lng_passcode_autolock_hours(lt_count, autolock / 3600);
? tr::lng_passcode_autolock_minutes(tr::now, lt_count, autolock / 60)
: tr::lng_passcode_autolock_hours(tr::now, lt_count, autolock / 3600);
});
AddButtonWithLabel(
@ -263,7 +263,7 @@ void SetupCloudPassword(not_null<Ui::VerticalLayout*> container) {
) | rpl::filter([](const QString &pattern) {
return !pattern.isEmpty();
}) | rpl::map([](const QString &pattern) {
return lng_cloud_password_waiting_code(lt_email, pattern);
return tr::lng_cloud_password_waiting_code(tr::now, lt_email, pattern);
}));
auto unconfirmed = rpl::duplicate(
pattern

View file

@ -997,13 +997,14 @@ void FileLoadTask::process() {
void FileLoadTask::finish() {
if (!_result || !_result->filesize || _result->filesize < 0) {
Ui::show(
Box<InformBox>(lng_send_image_empty(lt_name, _filepath)),
Box<InformBox>(
tr::lng_send_image_empty(tr::now, lt_name, _filepath)),
LayerOption::KeepOther);
removeFromAlbum();
} else if (_result->filesize > App::kFileSizeLimit) {
Ui::show(
Box<InformBox>(
lng_send_image_too_large(lt_name, _filepath)),
tr::lng_send_image_too_large(tr::now, lt_name, _filepath)),
LayerOption::KeepOther);
removeFromAlbum();
} else if (App::main()) {

View file

@ -121,15 +121,18 @@ QString FormatDateTime(TimeId value) {
const auto now = QDateTime::currentDateTime();
const auto date = ParseDateTime(value);
if (date.date() == now.date()) {
return lng_mediaview_today(
return tr::lng_mediaview_today(
tr::now,
lt_time,
date.time().toString(cTimeFormat()));
} else if (date.date().addDays(1) == now.date()) {
return lng_mediaview_yesterday(
return tr::lng_mediaview_yesterday(
tr::now,
lt_time,
date.time().toString(cTimeFormat()));
} else {
return lng_mediaview_date_time(
return tr::lng_mediaview_date_time(
tr::now,
lt_date,
date.date().toString(qsl("dd.MM.yy")),
lt_time,

View file

@ -9,13 +9,20 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Ui {
namespace Text {
namespace details {
inline auto ToUpper() {
return rpl::map([](QString &&text) {
struct ToUpperType {
inline QString operator()(const QString &text) const {
return text.toUpper();
}
inline QString operator()(QString &&text) const {
return std::move(text).toUpper();
});
}
}
};
} // namespace details
inline constexpr auto Upper = details::ToUpperType{};
TextWithEntities Bold(const QString &text);
TextWithEntities Link(
const QString &text,
@ -25,6 +32,10 @@ inline TextWithEntities WithEntities(const QString &text) {
return { text };
}
inline auto ToUpper() {
return rpl::map(Upper);
}
inline auto ToBold() {
return rpl::map(Bold);
}

View file

@ -521,7 +521,7 @@ void NativeManager::doShowNotification(HistoryItem *item, int forwardedCount) {
? tr::lng_notification_preview(tr::now)
: (forwardedCount < 2
? (item->groupId() ? tr::lng_in_dlg_album(tr::now) : item->notificationText())
: lng_forward_messages(lt_count, forwardedCount));
: tr::lng_forward_messages(tr::now, lt_count, forwardedCount));
doShowNativeNotification(
item->history()->peer,

View file

@ -705,7 +705,7 @@ void Notification::updateNotifyDisplay() {
r.setTop(r.top() + st::dialogsTextFont->height);
}
p.setPen(st::dialogsTextFg);
p.drawText(r.left(), r.top() + st::dialogsTextFont->ascent, lng_forward_messages(lt_count, _forwardedCount));
p.drawText(r.left(), r.top() + st::dialogsTextFont->ascent, tr::lng_forward_messages(tr::now, lt_count, _forwardedCount));
}
} else {
static QString notifyText = st::dialogsTextFont->elided(tr::lng_notification_preview(tr::now), itemWidth);

View file

@ -563,7 +563,7 @@ ThemeExportBox::ThemeExportBox(QWidget*, const QByteArray &paletteContent, const
, _backgroundContent(backgroundContent)
, _chooseFromFile(this, tr::lng_settings_bg_from_file(tr::now), st::boxLinkButton)
, _tileBackground(this, tr::lng_settings_bg_tile(tr::now), tileBackground, st::defaultBoxCheckbox) {
_imageText = lng_theme_editor_saved_to_jpg(lt_size, formatSizeText(_backgroundContent.size()));
_imageText = tr::lng_theme_editor_saved_to_jpg(tr::now, lt_size, formatSizeText(_backgroundContent.size()));
_chooseFromFile->setClickedCallback([this] { chooseBackgroundFromFile(); });
}
@ -638,7 +638,7 @@ void ThemeExportBox::chooseBackgroundFromFile() {
_backgroundContent = content;
_isPng = (format == "png");
auto sizeText = formatSizeText(_backgroundContent.size());
_imageText = _isPng ? lng_theme_editor_read_from_png(lt_size, sizeText) : lng_theme_editor_read_from_jpg(lt_size, sizeText);
_imageText = _isPng ? tr::lng_theme_editor_read_from_png(tr::now, lt_size, sizeText) : tr::lng_theme_editor_read_from_jpg(tr::now, lt_size, sizeText);
_tileBackground->setChecked(false);
updateThumbnail();
}

View file

@ -106,7 +106,7 @@ void WarningWidget::setSecondsLeft(int secondsLeft) {
}
void WarningWidget::updateText() {
_text = lng_theme_reverting(lt_count, _secondsLeft);
_text = tr::lng_theme_reverting(tr::now, lt_count, _secondsLeft);
}
void WarningWidget::showAnimated() {

View file

@ -404,12 +404,12 @@ auto ConnectionState::computeLayout(const State &state) const -> Layout {
case State::Type::Waiting:
Assert(state.waitTillRetry > 0);
result.text = lng_reconnecting(lt_count, state.waitTillRetry);
result.text = tr::lng_reconnecting(tr::now, lt_count, state.waitTillRetry);
break;
}
result.textWidth = st::normalFont->width(result.text);
const auto maxTextWidth = (state.type == State::Type::Waiting)
? st::normalFont->width(lng_reconnecting(lt_count, 88))
? st::normalFont->width(tr::lng_reconnecting(tr::now, lt_count, 88))
: result.textWidth;
result.contentWidth = (result.textWidth > 0)
? (st::connectingTextPadding.left()

View file

@ -224,7 +224,7 @@ void TermsBox::prepare() {
this,
object_ptr<Ui::Checkbox>(
this,
lng_terms_age(lt_count, *_data.minAge),
tr::lng_terms_age(tr::now, lt_count, *_data.minAge),
st::defaultCheckbox,
std::move(check)),
st::termsAgePadding)
@ -251,7 +251,7 @@ void TermsBox::prepare() {
: QString();
if (TextUtilities::RegExpMention().match(link).hasMatch()) {
_lastClickedMention = link;
Ui::Toast::Show(lng_terms_agree_to_proceed(lt_bot, link));
Ui::Toast::Show(tr::lng_terms_agree_to_proceed(tr::now, lt_bot, link));
return false;
}
return true;

View file

@ -197,7 +197,7 @@ MainMenu::MainMenu(
qsl("Telegram Desktop"),
qsl("https://desktop.telegram.org")));
_telegram->setLinksTrusted();
_version->setRichText(textcmdLink(1, lng_settings_current_version(lt_version, currentVersionText())) + QChar(' ') + QChar(8211) + QChar(' ') + textcmdLink(2, tr::lng_menu_about(tr::now)));
_version->setRichText(textcmdLink(1, tr::lng_settings_current_version(tr::now, lt_version, currentVersionText())) + QChar(' ') + QChar(8211) + QChar(' ') + textcmdLink(2, tr::lng_menu_about(tr::now)));
_version->setLink(1, std::make_shared<UrlClickHandler>(qsl("https://desktop.telegram.org/changelog")));
_version->setLink(2, std::make_shared<LambdaClickHandler>([] { Ui::show(Box<AboutBox>()); }));

View file

@ -56,7 +56,7 @@ Bar::Bar(not_null<QWidget*> parent, QDate date)
_title->setTryMakeSimilarLines(true);
_details->setTryMakeSimilarLines(true);
_details->setText(_soon
? lng_outdated_soon(lt_date, langDayOfMonthFull(date))
? tr::lng_outdated_soon(tr::now, lt_date, langDayOfMonthFull(date))
: tr::lng_outdated_now(tr::now));
}

View file

@ -138,7 +138,8 @@ bool PinnedLimitReached(Dialogs::Key key) {
Auth().data().setChatPinned(key, true);
Auth().api().savePinnedOrder(folder);
} else {
auto errorText = lng_error_pinned_max(
auto errorText = tr::lng_error_pinned_max(
tr::now,
lt_count,
pinnedMax);
Ui::show(Box<InformBox>(errorText));
@ -624,7 +625,8 @@ void PeerMenuExportChat(not_null<PeerData*> peer) {
}
void PeerMenuDeleteContact(not_null<UserData*> user) {
const auto text = lng_sure_delete_contact(
const auto text = tr::lng_sure_delete_contact(
tr::now,
lt_contact,
App::peerName(user));
const auto deleteSure = [=] {
@ -662,7 +664,7 @@ void PeerMenuShareContactBox(not_null<UserData*> user) {
? peer->name
: '\xAB' + peer->name + '\xBB';
Ui::show(Box<ConfirmBox>(
lng_forward_share_contact(lt_recipient, recipient),
tr::lng_forward_share_contact(tr::now, lt_recipient, recipient),
tr::lng_forward_send(tr::now),
[peer, user] {
const auto history = peer->owner().history(peer);
@ -768,7 +770,7 @@ void PeerMenuBlockUserBox(
}
Ui::Toast::Show(
lng_new_contact_block_done(lt_user, user->shortName()));
tr::lng_new_contact_block_done(tr::now, lt_user, user->shortName()));
}, st::attentionBoxButton);
box->addButton(tr::lng_cancel(), [=] {