2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Use tr:: instead of lang().

This commit is contained in:
John Preston
2019-06-19 17:09:03 +02:00
parent d3ca6b96a1
commit 87fc066e67
168 changed files with 1905 additions and 1744 deletions

View File

@@ -105,7 +105,7 @@ InnerWidget::InnerWidget(
, _pinnedShiftAnimation([=](crl::time now) {
return pinnedShiftAnimationCallback(now);
})
, _addContactLnk(this, lang(lng_add_contact_button))
, _addContactLnk(this, tr::lng_add_contact_button(tr::now))
, _cancelSearchInChat(this, st::dialogsCancelSearchInPeer)
, _cancelSearchFromUser(this, st::dialogsCancelSearchInPeer) {
@@ -478,7 +478,12 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
p.fillRect(dialogsClip, st::dialogsBg);
p.setFont(st::noContactsFont);
p.setPen(st::noContactsColor);
p.drawText(QRect(0, 0, fullWidth, st::noContactsHeight - (session().data().contactsLoaded().current() ? st::noContactsFont->height : 0)), lang(session().data().contactsLoaded().current() ? lng_no_chats : lng_contacts_loading), style::al_center);
p.drawText(
QRect(0, 0, fullWidth, st::noContactsHeight - (session().data().contactsLoaded().current() ? st::noContactsFont->height : 0)),
(session().data().contactsLoaded().current()
? tr::lng_no_chats
: tr::lng_contacts_loading)(tr::now),
style::al_center);
}
} else if (_state == WidgetState::Filtered) {
if (!_hashtagResults.empty()) {
@@ -557,7 +562,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
p.fillRect(0, 0, fullWidth, st::searchedBarHeight, st::searchedBarBg);
p.setFont(st::searchedBarFont);
p.setPen(st::searchedBarFg);
p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), lang(lng_search_global_results));
p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), tr::lng_search_global_results(tr::now));
p.translate(0, st::searchedBarHeight);
auto skip = peerSearchOffset();
@@ -598,7 +603,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
st::searchedBarPosition.x(),
st::searchedBarPosition.y(),
width(),
lang(lng_dlg_search_for_messages));
tr::lng_dlg_search_for_messages(tr::now));
p.translate(0, st::searchedBarHeight);
}
}
@@ -606,7 +611,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
const auto showUnreadInSearchResults = uniqueSearchResults();
if (!_waitingForSearch || !_searchResults.empty()) {
const auto text = _searchResults.empty()
? lang(lng_search_no_results)
? tr::lng_search_no_results(tr::now)
: showUnreadInSearchResults
? qsl("Search results")
: lng_search_found_results(
@@ -676,8 +681,8 @@ void InnerWidget::paintCollapsedRow(
const auto text = row->folder
? row->folder->chatListName()
: (_mode == Dialogs::Mode::Important)
? (narrow ? "Show" : lang(lng_dialogs_show_all_chats))
: (narrow ? "Hide" : lang(lng_dialogs_hide_muted_chats));
? (narrow ? "Show" : tr::lng_dialogs_show_all_chats(tr::now))
: (narrow ? "Hide" : tr::lng_dialogs_hide_muted_chats(tr::now));
const auto unread = row->folder
? row->folder->chatListUnreadCount()
: (_mode == Dialogs::Mode::Important)
@@ -768,7 +773,7 @@ void InnerWidget::paintSearchInChat(Painter &p) const {
p.fillRect(0, 0, width(), top, st::searchedBarBg);
p.setFont(st::searchedBarFont);
p.setPen(st::searchedBarFg);
p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), lang(lng_dlg_search_in));
p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), tr::lng_dlg_search_in(tr::now));
auto fullRect = QRect(0, top, width(), height - top);
p.fillRect(fullRect, st::dialogsBg);
@@ -1699,9 +1704,9 @@ void InnerWidget::fillArchiveSearchMenu(not_null<Ui::PopupMenu*> menu) {
return;
}
const auto skip = session().settings().skipArchiveInSearch();
const auto text = lang(skip
? lng_dialogs_show_archive_in_search
: lng_dialogs_skip_archive_in_search);
const auto text = skip
? tr::lng_dialogs_show_archive_in_search(tr::now)
: tr::lng_dialogs_skip_archive_in_search(tr::now);
menu->addAction(text, [=] {
session().settings().setSkipArchiveInSearch(!skip);
session().saveSettingsDelayed();
@@ -2225,7 +2230,7 @@ void InnerWidget::refreshSearchInChatLabel() {
const auto dialog = [&] {
if (const auto peer = _searchInChat.peer()) {
if (peer->isSelf()) {
return lang(lng_saved_messages);
return tr::lng_saved_messages(tr::now);
}
return peer->name;
//} else if (const auto feed = _searchInChat.feed()) { // #feed

View File

@@ -295,7 +295,7 @@ void paintRow(
const auto promoted = (history && history->useProxyPromotion())
&& !(flags & (Flag::SearchResult/* | Flag::FeedSearchResult*/)); // #feed
if (promoted) {
const auto text = lang(lng_proxy_sponsor);
const auto text = tr::lng_proxy_sponsor(tr::now);
PaintRowTopRight(p, text, rectForName, active, selected);
} else if (from/* && !(flags & Flag::FeedSearchResult)*/) { // #feed
if (const auto chatTypeIcon = ChatTypeIcon(from, active, selected)) {
@@ -329,7 +329,7 @@ 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, lang(lng_from_draft)));
auto draftWrapped = textcmdLink(1, lng_dialogs_text_from_wrapped(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));
@@ -414,7 +414,7 @@ void paintRow(
p.setPen(nameFg);
if (flags & Flag::SavedMessages) {
p.setFont(st::msgNameFont);
auto text = lang(lng_saved_messages);
auto text = tr::lng_saved_messages(tr::now);
auto textWidth = st::msgNameFont->width(text);
if (textWidth > rectForName.width()) {
text = st::msgNameFont->elided(text, rectForName.width());

View File

@@ -476,7 +476,7 @@ void Widget::checkUpdateStatus() {
if (_updateTelegram) return;
_updateTelegram.create(
this,
lang(lng_update_telegram),
tr::lng_update_telegram(tr::now),
st::dialogsUpdateButton,
st::dialogsInstallUpdate,
st::dialogsInstallUpdateOver);
@@ -1563,7 +1563,7 @@ void Widget::paintEvent(QPaintEvent *e) {
p.fillRect(0, aboveTop, width(), st::dialogsForwardHeight, st::dialogsForwardBg);
p.setPen(st::dialogsForwardFg);
p.setFont(st::dialogsForwardFont);
p.drawTextLeft(st::dialogsForwardTextLeft, st::dialogsForwardTextTop, width(), lang(lng_forward_choose));
p.drawTextLeft(st::dialogsForwardTextLeft, st::dialogsForwardTextTop, width(), tr::lng_forward_choose(tr::now));
aboveTop += st::dialogsForwardHeight;
}
auto above = QRect(0, aboveTop, width(), _scroll->y() - aboveTop);