2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +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

@@ -47,11 +47,11 @@ void SetupConnectionType(not_null<Ui::VerticalLayout*> container) {
const auto transport = MTP::dctransport();
if (Global::ProxySettings() != ProxyData::Settings::Enabled) {
return transport.isEmpty()
? lang(lng_connection_auto_connecting)
? tr::lng_connection_auto_connecting(tr::now)
: lng_connection_auto(lt_transport, transport);
} else {
return transport.isEmpty()
? lang(lng_connection_proxy_connecting)
? tr::lng_connection_proxy_connecting(tr::now)
: lng_connection_proxy(lt_transport, transport);
}
};
@@ -143,7 +143,7 @@ void SetupUpdate(not_null<Ui::VerticalLayout*> container) {
showDownloadProgress(checker.already(), checker.size());
break;
case State::Ready:
texts->fire(lang(lng_settings_update_ready));
texts->fire(tr::lng_settings_update_ready(tr::now));
update->show();
break;
default:
@@ -198,12 +198,12 @@ void SetupUpdate(not_null<Ui::VerticalLayout*> container) {
checker.checking() | rpl::start_with_next([=] {
options->setAttribute(Qt::WA_TransparentForMouseEvents);
texts->fire(lang(lng_settings_update_checking));
texts->fire(tr::lng_settings_update_checking(tr::now));
downloading->fire(false);
}, options->lifetime());
checker.isLatest() | rpl::start_with_next([=] {
options->setAttribute(Qt::WA_TransparentForMouseEvents, false);
texts->fire(lang(lng_settings_latest_installed));
texts->fire(tr::lng_settings_latest_installed(tr::now));
downloading->fire(false);
}, options->lifetime());
checker.progress(
@@ -212,12 +212,12 @@ void SetupUpdate(not_null<Ui::VerticalLayout*> container) {
}, options->lifetime());
checker.failed() | rpl::start_with_next([=] {
options->setAttribute(Qt::WA_TransparentForMouseEvents, false);
texts->fire(lang(lng_settings_update_fail));
texts->fire(tr::lng_settings_update_fail(tr::now));
downloading->fire(false);
}, options->lifetime());
checker.ready() | rpl::start_with_next([=] {
options->setAttribute(Qt::WA_TransparentForMouseEvents, false);
texts->fire(lang(lng_settings_update_ready));
texts->fire(tr::lng_settings_update_ready(tr::now));
update->show();
downloading->fire(false);
}, options->lifetime());
@@ -243,19 +243,19 @@ bool HasTray() {
}
void SetupTrayContent(not_null<Ui::VerticalLayout*> container) {
const auto checkbox = [&](LangKey label, bool checked) {
const auto checkbox = [&](const QString &label, bool checked) {
return object_ptr<Ui::Checkbox>(
container,
lang(label),
label,
checked,
st::settingsCheckbox);
};
const auto addCheckbox = [&](LangKey label, bool checked) {
const auto addCheckbox = [&](const QString &label, bool checked) {
return container->add(
checkbox(label, checked),
st::settingsCheckboxPadding);
};
const auto addSlidingCheckbox = [&](LangKey label, bool checked) {
const auto addSlidingCheckbox = [&](const QString &label, bool checked) {
return container->add(
object_ptr<Ui::SlideWrap<Ui::Checkbox>>(
container,
@@ -269,7 +269,7 @@ void SetupTrayContent(not_null<Ui::VerticalLayout*> container) {
|| (workMode == dbiwmWindowAndTray);
};
const auto tray = addCheckbox(
lng_settings_workmode_tray,
tr::lng_settings_workmode_tray(tr::now),
trayEnabled());
const auto taskbarEnabled = [] {
@@ -279,7 +279,7 @@ void SetupTrayContent(not_null<Ui::VerticalLayout*> container) {
};
const auto taskbar = Platform::IsWindows()
? addCheckbox(
lng_settings_workmode_window,
tr::lng_settings_workmode_window(tr::now),
taskbarEnabled())
: nullptr;
@@ -328,13 +328,13 @@ void SetupTrayContent(not_null<Ui::VerticalLayout*> container) {
};
const auto autostart = addCheckbox(
lng_settings_auto_start,
tr::lng_settings_auto_start(tr::now),
cAutoStart());
const auto minimized = addSlidingCheckbox(
lng_settings_start_min,
tr::lng_settings_start_min(tr::now),
minimizedToggled());
const auto sendto = addCheckbox(
lng_settings_add_sendto,
tr::lng_settings_add_sendto(tr::now),
cSendToMenu());
autostart->checkedChanges(
@@ -360,7 +360,7 @@ void SetupTrayContent(not_null<Ui::VerticalLayout*> container) {
if (Global::LocalPasscode()) {
minimized->entity()->setChecked(false);
Ui::show(Box<InformBox>(
lang(lng_error_start_minimized_passcoded)));
tr::lng_error_start_minimized_passcoded(tr::now)));
} else {
cSetStartMinimized(checked);
Local::writeSettings();

View File

@@ -69,7 +69,7 @@ void Calls::setupContent() {
const auto currentOutputName = [&] {
if (Global::CallOutputDeviceID() == qsl("default")) {
return lang(lng_settings_call_device_default);
return tr::lng_settings_call_device_default(tr::now);
}
const auto &list = VoIPController::EnumerateAudioOutputs();
const auto i = ranges::find(
@@ -83,7 +83,7 @@ void Calls::setupContent() {
const auto currentInputName = [&] {
if (Global::CallInputDeviceID() == qsl("default")) {
return lang(lng_settings_call_device_default);
return tr::lng_settings_call_device_default(tr::now);
}
const auto &list = VoIPController::EnumerateAudioInputs();
const auto i = ranges::find(
@@ -109,7 +109,7 @@ void Calls::setupContent() {
)->addClickHandler([=] {
const auto &devices = VoIPController::EnumerateAudioOutputs();
const auto options = ranges::view::concat(
ranges::view::single(lang(lng_settings_call_device_default)),
ranges::view::single(tr::lng_settings_call_device_default(tr::now)),
devices | ranges::view::transform(getName)
) | ranges::to_vector;
const auto i = ranges::find(
@@ -184,7 +184,7 @@ void Calls::setupContent() {
)->addClickHandler([=] {
const auto &devices = VoIPController::EnumerateAudioInputs();
const auto options = ranges::view::concat(
ranges::view::single(lang(lng_settings_call_device_default)),
ranges::view::single(tr::lng_settings_call_device_default(tr::now)),
devices | ranges::view::transform(getName)
) | ranges::to_vector;
const auto i = ranges::find(
@@ -249,7 +249,7 @@ void Calls::setupContent() {
AddButton(
content,
rpl::single(
lang(lng_settings_call_test_mic)
tr::lng_settings_call_test_mic(tr::now)
) | rpl::then(
_micTestTextStream.events()
),
@@ -304,7 +304,7 @@ void Calls::setupContent() {
const auto opened = Platform::OpenSystemSettings(
Platform::SystemSettingsType::Audio);
if (!opened) {
Ui::show(Box<InformBox>(lang(lng_linux_no_audio_prefs)));
Ui::show(Box<InformBox>(tr::lng_linux_no_audio_prefs(tr::now)));
}
});
AddSkip(content);
@@ -336,25 +336,25 @@ void Calls::requestPermissionAndStartTestingMicrophone() {
Ui::hideLayer();
};
Ui::show(Box<ConfirmBox>(
lang(lng_no_mic_permission),
lang(lng_menu_settings),
tr::lng_no_mic_permission(tr::now),
tr::lng_menu_settings(tr::now),
showSystemSettings));
}
}
void Calls::startTestingMicrophone() {
_micTestTextStream.fire(lang(lng_settings_call_stop_mic_test));
_micTestTextStream.fire(tr::lng_settings_call_stop_mic_test(tr::now));
_levelUpdateTimer.callEach(50);
_micTester = std::make_unique<tgvoip::AudioInputTester>(
Global::CallInputDeviceID().toStdString());
if (_micTester->Failed()) {
stopTestingMicrophone();
Ui::show(Box<InformBox>(lang(lng_call_error_audio_io)));
Ui::show(Box<InformBox>(tr::lng_call_error_audio_io(tr::now)));
}
}
void Calls::stopTestingMicrophone() {
_micTestTextStream.fire(lang(lng_settings_call_test_mic));
_micTestTextStream.fire(tr::lng_settings_call_test_mic(tr::now));
_levelUpdateTimer.cancel();
_micTester.reset();
_micTestLevel->setValue(0.0f);

View File

@@ -111,9 +111,9 @@ void ChooseFromFile(not_null<QWidget*> parent);
BackgroundRow::BackgroundRow(QWidget *parent) : RpWidget(parent)
, _chooseFromGallery(
this,
lang(lng_settings_bg_from_gallery),
tr::lng_settings_bg_from_gallery(tr::now),
st::settingsLink)
, _chooseFromFile(this, lang(lng_settings_bg_from_file), st::settingsLink)
, _chooseFromFile(this, tr::lng_settings_bg_from_file(tr::now), st::settingsLink)
, _radial([=](crl::time now) { radialAnimationCallback(now); }) {
updateImage();
@@ -400,7 +400,7 @@ void ChooseFromFile(not_null<QWidget*> parent) {
};
FileDialog::GetOpenPath(
parent.get(),
lang(lng_choose_image),
tr::lng_choose_image(tr::now),
filters.join(qsl(";;")),
crl::guard(parent, callback));
@@ -408,9 +408,9 @@ void ChooseFromFile(not_null<QWidget*> parent) {
QString DownloadPathText() {
if (Global::DownloadPath().isEmpty()) {
return lang(lng_download_path_default);
return tr::lng_download_path_default(tr::now);
} else if (Global::DownloadPath() == qsl("tmp")) {
return lang(lng_download_path_temp);
return tr::lng_download_path_temp(tr::now);
}
return QDir::toNativeSeparators(Global::DownloadPath());
}
@@ -428,14 +428,14 @@ void SetupStickersEmoji(not_null<Ui::VerticalLayout*> container) {
std::move(wrap),
QMargins(0, 0, 0, st::settingsCheckbox.margin.bottom())));
const auto checkbox = [&](LangKey label, bool checked) {
const auto checkbox = [&](const QString &label, bool checked) {
return object_ptr<Ui::Checkbox>(
container,
lang(label),
label,
checked,
st::settingsCheckbox);
};
const auto add = [&](LangKey label, bool checked, auto &&handle) {
const auto add = [&](const QString &label, bool checked, auto &&handle) {
inner->add(
checkbox(label, checked),
st::settingsCheckboxPadding
@@ -445,7 +445,7 @@ void SetupStickersEmoji(not_null<Ui::VerticalLayout*> container) {
inner->lifetime());
};
add(
lng_settings_replace_emojis,
tr::lng_settings_replace_emojis(tr::now),
Global::ReplaceEmoji(),
[](bool checked) {
Global::SetReplaceEmoji(checked);
@@ -454,7 +454,7 @@ void SetupStickersEmoji(not_null<Ui::VerticalLayout*> container) {
});
add(
lng_settings_suggest_emoji,
tr::lng_settings_suggest_emoji(tr::now),
Global::SuggestEmoji(),
[](bool checked) {
Global::SetSuggestEmoji(checked);
@@ -462,7 +462,7 @@ void SetupStickersEmoji(not_null<Ui::VerticalLayout*> container) {
});
add(
lng_settings_suggest_by_emoji,
tr::lng_settings_suggest_by_emoji(tr::now),
Global::SuggestStickersByEmoji(),
[](bool checked) {
Global::SetSuggestStickersByEmoji(checked);
@@ -513,24 +513,24 @@ void SetupMessages(not_null<Ui::VerticalLayout*> container) {
const auto group = std::make_shared<Ui::RadioenumGroup<SendByType>>(
Auth().settings().sendSubmitWay());
const auto add = [&](SendByType value, LangKey key) {
const auto add = [&](SendByType value, const QString &text) {
inner->add(
object_ptr<Ui::Radioenum<SendByType>>(
inner,
group,
value,
lang(key),
text,
st::settingsSendType),
st::settingsSendTypePadding);
};
const auto small = st::settingsSendTypePadding;
const auto top = skip;
add(SendByType::Enter, lng_settings_send_enter);
add(SendByType::Enter, tr::lng_settings_send_enter(tr::now));
add(
SendByType::CtrlEnter,
(Platform::IsMac()
? lng_settings_send_cmdenter
: lng_settings_send_ctrlenter));
? tr::lng_settings_send_cmdenter(tr::now)
: tr::lng_settings_send_ctrlenter(tr::now)));
group->setChangedCallback([](SendByType value) {
Auth().settings().setSendSubmitWay(value);
@@ -677,7 +677,7 @@ void SetupChatBackground(not_null<Ui::VerticalLayout*> container) {
const auto tile = inner->add(
object_ptr<Ui::Checkbox>(
inner,
lang(lng_settings_bg_tile),
tr::lng_settings_bg_tile(tr::now),
Window::Theme::Background()->tile(),
st::settingsCheckbox),
st::settingsSendTypePadding);
@@ -686,7 +686,7 @@ void SetupChatBackground(not_null<Ui::VerticalLayout*> container) {
inner,
object_ptr<Ui::Checkbox>(
inner,
lang(lng_settings_adaptive_wide),
tr::lng_settings_adaptive_wide(tr::now),
Global::AdaptiveForWide(),
st::settingsCheckbox),
st::settingsSendTypePadding));

View File

@@ -173,11 +173,11 @@ void AddSubsectionTitle(
void FillMenu(Fn<void(Type)> showOther, MenuCallback addAction) {
if (!Auth().supportMode()) {
addAction(
lang(lng_settings_information),
tr::lng_settings_information(tr::now),
[=] { showOther(Type::Information); });
}
addAction(
lang(lng_settings_logout),
tr::lng_settings_logout(tr::now),
[=] { App::wnd()->onLogout(); });
}

View File

@@ -71,12 +71,12 @@ void SetupPhoto(
if (image.isNull()
|| image.width() > 10 * image.height()
|| image.height() > 10 * image.width()) {
Ui::show(Box<InformBox>(lang(lng_bad_photo)));
Ui::show(Box<InformBox>(tr::lng_bad_photo(tr::now)));
return;
}
const auto box = Ui::show(
Box<PhotoCropBox>(image, lang(lng_settings_crop_profile)));
Box<PhotoCropBox>(image, tr::lng_settings_crop_profile(tr::now)));
box->ready(
) | rpl::start_with_next([=](QImage &&image) {
Auth().api().uploadPeerPhoto(self, std::move(image));
@@ -84,7 +84,7 @@ void SetupPhoto(
};
FileDialog::GetOpenPath(
upload,
lang(lng_choose_image),
tr::lng_choose_image(tr::now),
filter,
crl::guard(upload, callback));
});

View File

@@ -175,8 +175,8 @@ void SetupInterfaceScale(
[=] { (*setScale)(cConfigScale()); });
});
Ui::show(Box<ConfirmBox>(
lang(lng_settings_need_restart),
lang(lng_settings_restart_now),
tr::lng_settings_need_restart(tr::now),
tr::lng_settings_restart_now(tr::now),
confirmed,
cancelled));
} else if (scale != cConfigScale()) {
@@ -247,9 +247,9 @@ void SetupHelp(not_null<Ui::VerticalLayout*> container) {
Auth().api().requestSupportContact(ready);
});
auto box = Box<ConfirmBox>(
lang(lng_settings_ask_sure),
lang(lng_settings_ask_ok),
lang(lng_settings_faq_button),
tr::lng_settings_ask_sure(tr::now),
tr::lng_settings_ask_ok(tr::now),
tr::lng_settings_faq_button(tr::now),
sure,
OpenFaq);
box->setStrictCancel(true);

View File

@@ -272,7 +272,7 @@ void NotificationsCount::prepareNotificationSampleLarge() {
auto rectForName = rtlrect(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyTextTop, itemWidth, st::msgNameFont->height, w);
auto notifyText = st::dialogsTextFont->elided(lang(lng_notification_sample), itemWidth);
auto notifyText = st::dialogsTextFont->elided(tr::lng_notification_sample(tr::now), itemWidth);
p.setFont(st::dialogsTextFont);
p.setPen(st::dialogsTextFgService);
p.drawText(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyItemTop + st::msgNameFont->height + st::dialogsTextFont->ascent, notifyText);
@@ -517,19 +517,19 @@ void SetupAdvancedNotifications(not_null<Ui::VerticalLayout*> container) {
void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
AddSubsectionTitle(container, tr::lng_settings_notify_title());
const auto checkbox = [&](LangKey label, bool checked) {
const auto checkbox = [&](const QString &label, bool checked) {
return object_ptr<Ui::Checkbox>(
container,
lang(label),
label,
checked,
st::settingsCheckbox);
};
const auto addCheckbox = [&](LangKey label, bool checked) {
const auto addCheckbox = [&](const QString &label, bool checked) {
return container->add(
checkbox(label, checked),
st::settingsCheckboxPadding);
};
const auto addSlidingCheckbox = [&](LangKey label, bool checked) {
const auto addSlidingCheckbox = [&](const QString &label, bool checked) {
return container->add(
object_ptr<Ui::SlideWrap<Ui::Checkbox>>(
container,
@@ -537,16 +537,16 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
st::settingsCheckboxPadding));
};
const auto desktop = addCheckbox(
lng_settings_desktop_notify,
tr::lng_settings_desktop_notify(tr::now),
Global::DesktopNotify());
const auto name = addSlidingCheckbox(
lng_settings_show_name,
tr::lng_settings_show_name(tr::now),
(Global::NotifyView() <= dbinvShowName));
const auto preview = addSlidingCheckbox(
lng_settings_show_preview,
tr::lng_settings_show_preview(tr::now),
(Global::NotifyView() <= dbinvShowPreview));
const auto sound = addCheckbox(
lng_settings_sound_notify,
tr::lng_settings_sound_notify(tr::now),
Global::SoundNotify());
AddSkip(container, st::settingsCheckboxesSkip);
@@ -555,10 +555,10 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
AddSubsectionTitle(container, tr::lng_settings_badge_title());
const auto muted = addCheckbox(
lng_settings_include_muted,
tr::lng_settings_include_muted(tr::now),
Auth().settings().includeMutedCounter());
const auto count = addCheckbox(
lng_settings_count_unread,
tr::lng_settings_count_unread(tr::now),
Auth().settings().countUnreadMessages());
@@ -568,7 +568,7 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
AddSubsectionTitle(container, tr::lng_settings_events_title());
const auto joined = addCheckbox(
lng_settings_events_joined,
tr::lng_settings_events_joined(tr::now),
!Auth().api().contactSignupSilentCurrent().value_or(false));
Auth().api().contactSignupSilent(
) | rpl::start_with_next([=](bool silent) {
@@ -583,7 +583,7 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
}, joined->lifetime());
const auto pinned = addCheckbox(
lng_settings_events_pinned,
tr::lng_settings_events_pinned(tr::now),
Auth().settings().notifyAboutPinned());
Auth().settings().notifyAboutPinnedChanges(
) | rpl::start_with_next([=](bool notify) {
@@ -597,18 +597,18 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
Auth().saveSettingsDelayed();
}, joined->lifetime());
const auto nativeKey = [&] {
const auto nativeText = [&] {
if (!Platform::Notifications::Supported()) {
return LangKey();
return QString();
} else if (Platform::IsWindows()) {
return lng_settings_use_windows;
return tr::lng_settings_use_windows(tr::now);
} else if (Platform::IsLinux()) {
return lng_settings_use_native_notifications;
return tr::lng_settings_use_native_notifications(tr::now);
}
return LangKey();
return QString();
}();
const auto native = [&]() -> Ui::Checkbox* {
if (!nativeKey) {
if (nativeText.isEmpty()) {
return nullptr;
}
@@ -616,7 +616,7 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
AddDivider(container);
AddSkip(container, st::settingsCheckboxesSkip);
AddSubsectionTitle(container, tr::lng_settings_native_title());
return addCheckbox(nativeKey, Global::NativeNotifications());
return addCheckbox(nativeText, Global::NativeNotifications());
}();
const auto advancedSlide = !Platform::IsMac10_8OrGreater()

View File

@@ -81,7 +81,7 @@ void BlockUserBoxController::updateIsBlocked(not_null<PeerListRow*> row, UserDat
auto blocked = user->isBlocked();
row->setDisabledState(blocked ? PeerListRow::State::DisabledChecked : PeerListRow::State::Active);
if (blocked) {
row->setCustomStatus(lang(lng_blocked_list_already_blocked));
row->setCustomStatus(tr::lng_blocked_list_already_blocked(tr::now));
} else {
row->clearCustomStatus();
}
@@ -155,7 +155,7 @@ AdminLog::OwnedItem GenerateForwardedItem(
void BlockedBoxController::prepare() {
delegate()->peerListSetTitle(tr::lng_blocked_list_title());
setDescriptionText(lang(lng_contacts_loading));
setDescriptionText(tr::lng_contacts_loading(tr::now));
delegate()->peerListRefreshRows();
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(Notify::PeerUpdate::Flag::UserIsBlocked, [this](const Notify::PeerUpdate &update) {
@@ -169,7 +169,7 @@ void BlockedBoxController::prepare() {
) | rpl::take(
1
) | rpl::start_with_next([=](const ApiWrap::BlockedUsersSlice &result) {
setDescriptionText(lang(lng_blocked_list_about));
setDescriptionText(tr::lng_blocked_list_about(tr::now));
_loadRequestId = 0;
_offset = result.list.size();
_allLoaded = (_offset >= result.total);
@@ -286,18 +286,18 @@ bool BlockedBoxController::prependRow(not_null<UserData*> user) {
std::unique_ptr<PeerListRow> BlockedBoxController::createRow(
not_null<UserData*> user) const {
auto row = std::make_unique<PeerListRowWithLink>(user);
row->setActionLink(lang((user->isBot() && !user->isSupport())
? lng_blocked_list_restart
: lng_blocked_list_unblock));
row->setActionLink((user->isBot() && !user->isSupport())
? tr::lng_blocked_list_restart(tr::now)
: tr::lng_blocked_list_unblock(tr::now));
const auto status = [&] {
if (!user->phone().isEmpty()) {
return App::formatPhone(user->phone());
} else if (!user->username.isEmpty()) {
return '@' + user->username;
} else if (user->botInfo) {
return lang(lng_status_bot);
return tr::lng_status_bot(tr::now);
}
return lang(lng_blocked_list_unknown_phone);
return tr::lng_blocked_list_unknown_phone(tr::now);
}();
row->setCustomStatus(status);
return std::move(row);
@@ -403,9 +403,9 @@ void LastSeenPrivacyController::confirmSave(bool someAreDisallowed, FnMut<void()
Local::writeUserSettings();
};
auto box = Box<ConfirmBox>(
lang(lng_edit_privacy_lastseen_warning),
lang(lng_continue),
lang(lng_cancel),
tr::lng_edit_privacy_lastseen_warning(tr::now),
tr::lng_continue(tr::now),
tr::lng_cancel(tr::now),
std::move(callback));
*weakBox = Ui::show(std::move(box), LayerOption::KeepOther);
} else {
@@ -528,12 +528,12 @@ rpl::producer<QString> CallsPeer2PeerPrivacyController::optionsTitleKey() {
return tr::lng_edit_privacy_calls_p2p_header();
}
LangKey CallsPeer2PeerPrivacyController::optionLabelKey(
QString CallsPeer2PeerPrivacyController::optionLabel(
EditPrivacyBox::Option option) {
switch (option) {
case Option::Everyone: return lng_edit_privacy_calls_p2p_everyone;
case Option::Contacts: return lng_edit_privacy_calls_p2p_contacts;
case Option::Nobody: return lng_edit_privacy_calls_p2p_nobody;
case Option::Everyone: return tr::lng_edit_privacy_calls_p2p_everyone(tr::now);
case Option::Contacts: return tr::lng_edit_privacy_calls_p2p_contacts(tr::now);
case Option::Nobody: return tr::lng_edit_privacy_calls_p2p_nobody(tr::now);
}
Unexpected("Option value in optionsLabelKey.");
}
@@ -616,7 +616,7 @@ object_ptr<Ui::RpWidget> ForwardsPrivacyController::setupAboveWidget(
delegate(),
Auth().data().history(
peerFromUser(PeerData::kServiceNotificationsId)),
lang(lng_edit_privacy_forwards_sample_message));
tr::lng_edit_privacy_forwards_sample_message(tr::now));
const auto view = message.get();
auto result = object_ptr<Ui::RpWidget>(parent);
@@ -678,9 +678,12 @@ void ForwardsPrivacyController::PaintForwardedTooltip(
const auto phrase = lng_forwarded(
lt_user,
App::peerName(view->data()->history()->session().user()));
const auto possiblePosition = Lang::FindTagReplacementPosition(
lang(lng_forwarded__tagged),
lt_user);
const auto kReplacementPosition = QChar(0x0001);
const auto possiblePosition = tr::lng_forwarded(
tr::now,
lt_user,
QString(1, kReplacementPosition)
).indexOf(kReplacementPosition);
const auto position = (possiblePosition >= 0
&& possiblePosition < phrase.size())
? possiblePosition
@@ -691,18 +694,17 @@ void ForwardsPrivacyController::PaintForwardedTooltip(
< 2 * st::msgServiceFont->height;
const auto nameLeft = skip + (small ? st::msgServiceFont->width(before) : 0);
const auto right = skip + innerWidth;
const auto key = [&] {
const auto text = [&] {
switch (value) {
case Option::Everyone:
return lng_edit_privacy_forwards_sample_everyone;
return tr::lng_edit_privacy_forwards_sample_everyone(tr::now);
case Option::Contacts:
return lng_edit_privacy_forwards_sample_contacts;
return tr::lng_edit_privacy_forwards_sample_contacts(tr::now);
case Option::Nobody:
return lng_edit_privacy_forwards_sample_nobody;
return tr::lng_edit_privacy_forwards_sample_nobody(tr::now);
}
Unexpected("Option value in ForwardsPrivacyController.");
}();
const auto text = lang(key);
const auto &font = st::toastTextStyle.font;
const auto textWidth = font->width(text);
const auto arrowSkip = st::settingsForwardPrivacyArrowSkip;

View File

@@ -125,7 +125,7 @@ public:
rpl::producer<QString> title() override;
rpl::producer<QString> optionsTitleKey() override;
LangKey optionLabelKey(EditPrivacyBox::Option option) override;
QString optionLabel(EditPrivacyBox::Option option) override;
rpl::producer<QString> warning() override;
rpl::producer<QString> exceptionButtonTextKey(
Exception exception) override;

View File

@@ -49,30 +49,27 @@ rpl::producer<> PasscodeChanges() {
}
QString PrivacyBase(Privacy::Key key, Privacy::Option option) {
const auto phrase = [&] {
using Key = Privacy::Key;
using Option = Privacy::Option;
switch (key) {
case Key::CallsPeer2Peer:
switch (option) {
case Option::Everyone:
return lng_edit_privacy_calls_p2p_everyone;
case Option::Contacts:
return lng_edit_privacy_calls_p2p_contacts;
case Option::Nobody:
return lng_edit_privacy_calls_p2p_nobody;
}
Unexpected("Value in Privacy::Option.");
default:
switch (option) {
case Option::Everyone: return lng_edit_privacy_everyone;
case Option::Contacts: return lng_edit_privacy_contacts;
case Option::Nobody: return lng_edit_privacy_nobody;
}
Unexpected("Value in Privacy::Option.");
using Key = Privacy::Key;
using Option = Privacy::Option;
switch (key) {
case Key::CallsPeer2Peer:
switch (option) {
case Option::Everyone:
return tr::lng_edit_privacy_calls_p2p_everyone(tr::now);
case Option::Contacts:
return tr::lng_edit_privacy_calls_p2p_contacts(tr::now);
case Option::Nobody:
return tr::lng_edit_privacy_calls_p2p_nobody(tr::now);
}
}();
return lang(phrase);
Unexpected("Value in Privacy::Option.");
default:
switch (option) {
case Option::Everyone: return tr::lng_edit_privacy_everyone(tr::now);
case Option::Contacts: return tr::lng_edit_privacy_contacts(tr::now);
case Option::Nobody: return tr::lng_edit_privacy_nobody(tr::now);
}
Unexpected("Value in Privacy::Option.");
}
}
rpl::producer<QString> PrivacyString(Privacy::Key key) {
@@ -260,7 +257,7 @@ void SetupCloudPassword(not_null<Ui::VerticalLayout*> container) {
return state.unconfirmedPattern;
});
auto confirmation = rpl::single(
lang(lng_profile_loading)
tr::lng_profile_loading(tr::now)
) | rpl::then(rpl::duplicate(
pattern
) | rpl::filter([](const QString &pattern) {
@@ -531,8 +528,8 @@ object_ptr<BoxContent> CloudPasswordAppOutdatedBox() {
if (*box) (*box)->closeBox();
};
auto result = Box<ConfirmBox>(
lang(lng_passport_app_out_of_date),
lang(lng_menu_update),
tr::lng_passport_app_out_of_date(tr::now),
tr::lng_menu_update(tr::now),
callback);
*box = result.data();
return std::move(result);