2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Use tr:: instead of Lang::Viewer.

This commit is contained in:
John Preston
2019-06-18 14:16:43 +02:00
parent f35085800a
commit 7af0dd105e
43 changed files with 483 additions and 511 deletions

View File

@@ -23,7 +23,7 @@ namespace Passport {
Panel::Panel(not_null<PanelController*> controller)
: _controller(controller)
, _widget(std::make_unique<Ui::SeparatePanel>()) {
_widget->setTitle(Lang::Viewer(lng_passport_title));
_widget->setTitle(tr::lng_passport_title());
_widget->setInnerSize(st::passportPanelSize);
_widget->closeRequests(

View File

@@ -829,21 +829,21 @@ auto PanelController::deleteValueLabel() const
Expects(_editScope != nullptr);
if (hasValueDocument()) {
return Lang::Viewer(lng_passport_delete_document);
return tr::lng_passport_delete_document();
} else if (!hasValueFields()) {
return std::nullopt;
}
switch (_editScope->type) {
case Scope::Type::PersonalDetails:
case Scope::Type::Identity:
return Lang::Viewer(lng_passport_delete_details);
return tr::lng_passport_delete_details();
case Scope::Type::AddressDetails:
case Scope::Type::Address:
return Lang::Viewer(lng_passport_delete_address);
return tr::lng_passport_delete_address();
case Scope::Type::Email:
return Lang::Viewer(lng_passport_delete_email);
return tr::lng_passport_delete_email();
case Scope::Type::Phone:
return Lang::Viewer(lng_passport_delete_phone);
return tr::lng_passport_delete_phone();
}
Unexpected("Type in PanelController::deleteValueLabel.");
}

View File

@@ -234,15 +234,11 @@ void PanelEditContact::setupControls(
_content->add(
object_ptr<Info::Profile::Button>(
_content,
Lang::Viewer(
lng_passport_use_existing__tagged
) | rpl::map([=] {
return lng_passport_use_existing(
lt_existing,
(_scheme.format
? _scheme.format(existing)
: existing));
}),
tr::lng_passport_use_existing(
lt_existing,
rpl::single(_scheme.format
? _scheme.format(existing)
: existing)),
st::passportUploadButton),
st::passportUploadButtonPadding
)->addClickHandler([=] {

View File

@@ -210,9 +210,9 @@ Ui::SlideWrap<ScanButton> *EditScans::List::nonDeletedErrorRow() const {
}
rpl::producer<QString> EditScans::List::uploadButtonText() const {
return Lang::Viewer(files.empty()
? lng_passport_upload_scans
: lng_passport_upload_more) | Ui::Text::ToUpper();
return (files.empty()
? tr::lng_passport_upload_scans
: tr::lng_passport_upload_more)() | Ui::Text::ToUpper();
}
void EditScans::List::hideError() {
@@ -611,37 +611,37 @@ void EditScans::setupSpecialScans(
}
Unexpected("Type in special row title.");
};
const auto uploadKey = [=](FileType type, bool hasScan) {
const auto uploadText = [=](FileType type, bool hasScan) {
switch (type) {
case FileType::FrontSide:
return requiresBothSides
? (hasScan
? lng_passport_reupload_front_side
: lng_passport_upload_front_side)
? tr::lng_passport_reupload_front_side
: tr::lng_passport_upload_front_side)
: (hasScan
? lng_passport_reupload_main_page
: lng_passport_upload_main_page);
? tr::lng_passport_reupload_main_page
: tr::lng_passport_upload_main_page);
case FileType::ReverseSide:
return hasScan
? lng_passport_reupload_reverse_side
: lng_passport_upload_reverse_side;
? tr::lng_passport_reupload_reverse_side
: tr::lng_passport_upload_reverse_side;
case FileType::Selfie:
return hasScan
? lng_passport_reupload_selfie
: lng_passport_upload_selfie;
? tr::lng_passport_reupload_selfie
: tr::lng_passport_upload_selfie;
}
Unexpected("Type in special row upload key.");
};
const auto description = [&](FileType type) {
switch (type) {
case FileType::FrontSide:
return lang(requiresBothSides
? lng_passport_front_side_description
: lng_passport_main_page_description);
return requiresBothSides
? tr::lng_passport_front_side_description
: tr::lng_passport_main_page_description;
case FileType::ReverseSide:
return lang(lng_passport_reverse_side_description);
return tr::lng_passport_reverse_side_description;
case FileType::Selfie:
return lang(lng_passport_selfie_description);
return tr::lng_passport_selfie_description;
}
Unexpected("Type in special row upload key.");
};
@@ -684,7 +684,7 @@ void EditScans::setupSpecialScans(
}
auto label = scan.rowCreated.value(
) | rpl::map([=, type = type](bool created) {
return Lang::Viewer(uploadKey(type, created));
return uploadText(type, created)();
}) | rpl::flatten_latest(
) | Ui::Text::ToUpper();
scan.upload = inner->add(
@@ -701,7 +701,7 @@ void EditScans::setupSpecialScans(
inner,
object_ptr<Ui::FlatLabel>(
inner,
description(type),
description(type)(tr::now),
st::boxDividerLabel),
st::passportFormLabelPadding));
}