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:
@@ -65,38 +65,38 @@ Content ContentFromState(const ProcessingState &state) {
|
||||
};
|
||||
switch (state.step) {
|
||||
case Step::Initializing:
|
||||
pushMain(lang(lng_export_state_initializing));
|
||||
pushMain(tr::lng_export_state_initializing(tr::now));
|
||||
break;
|
||||
case Step::DialogsList:
|
||||
pushMain(lang(lng_export_state_chats_list));
|
||||
pushMain(tr::lng_export_state_chats_list(tr::now));
|
||||
break;
|
||||
case Step::PersonalInfo:
|
||||
pushMain(lang(lng_export_option_info));
|
||||
pushMain(tr::lng_export_option_info(tr::now));
|
||||
break;
|
||||
case Step::Userpics:
|
||||
pushMain(lang(lng_export_state_userpics));
|
||||
pushMain(tr::lng_export_state_userpics(tr::now));
|
||||
pushBytes(
|
||||
"userpic" + QString::number(state.entityIndex),
|
||||
state.bytesName);
|
||||
break;
|
||||
case Step::Contacts:
|
||||
pushMain(lang(lng_export_option_contacts));
|
||||
pushMain(tr::lng_export_option_contacts(tr::now));
|
||||
break;
|
||||
case Step::Sessions:
|
||||
pushMain(lang(lng_export_option_sessions));
|
||||
pushMain(tr::lng_export_option_sessions(tr::now));
|
||||
break;
|
||||
case Step::OtherData:
|
||||
pushMain(lang(lng_export_option_other));
|
||||
pushMain(tr::lng_export_option_other(tr::now));
|
||||
break;
|
||||
case Step::Dialogs:
|
||||
pushMain(lang(lng_export_state_chats));
|
||||
pushMain(tr::lng_export_state_chats(tr::now));
|
||||
push(
|
||||
"chat" + QString::number(state.entityIndex),
|
||||
(state.entityName.isEmpty()
|
||||
? lang(lng_deleted)
|
||||
? tr::lng_deleted(tr::now)
|
||||
: (state.entityType == ProcessingState::EntityType::Chat)
|
||||
? state.entityName
|
||||
: lang(lng_saved_messages)),
|
||||
: tr::lng_saved_messages(tr::now)),
|
||||
(state.itemCount > 0
|
||||
? (QString::number(state.itemIndex)
|
||||
+ " / "
|
||||
|
@@ -52,7 +52,7 @@ void SuggestBox::prepare() {
|
||||
|
||||
const auto content = Ui::CreateChild<Ui::FlatLabel>(
|
||||
this,
|
||||
lang(lng_export_suggest_text),
|
||||
tr::lng_export_suggest_text(tr::now),
|
||||
st::boxLabel);
|
||||
widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
@@ -72,17 +72,14 @@ void SuggestBox::prepare() {
|
||||
|
||||
Environment PrepareEnvironment() {
|
||||
auto result = Environment();
|
||||
const auto utfLang = [](LangKey key) {
|
||||
return lang(key).toUtf8();
|
||||
};
|
||||
result.internalLinksDomain = Global::InternalLinksDomain();
|
||||
result.aboutTelegram = utfLang(lng_export_about_telegram);
|
||||
result.aboutContacts = utfLang(lng_export_about_contacts);
|
||||
result.aboutFrequent = utfLang(lng_export_about_frequent);
|
||||
result.aboutSessions = utfLang(lng_export_about_sessions);
|
||||
result.aboutWebSessions = utfLang(lng_export_about_web_sessions);
|
||||
result.aboutChats = utfLang(lng_export_about_chats);
|
||||
result.aboutLeftChats = utfLang(lng_export_about_left_chats);
|
||||
result.aboutTelegram = tr::lng_export_about_telegram(tr::now).toUtf8();
|
||||
result.aboutContacts = tr::lng_export_about_contacts(tr::now).toUtf8();
|
||||
result.aboutFrequent = tr::lng_export_about_frequent(tr::now).toUtf8();
|
||||
result.aboutSessions = tr::lng_export_about_sessions(tr::now).toUtf8();
|
||||
result.aboutWebSessions = tr::lng_export_about_web_sessions(tr::now).toUtf8();
|
||||
result.aboutChats = tr::lng_export_about_chats(tr::now).toUtf8();
|
||||
result.aboutLeftChats = tr::lng_export_about_left_chats(tr::now).toUtf8();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -191,7 +188,7 @@ void PanelController::showError(const ApiErrorState &error) {
|
||||
LOG(("Export Info: API Error '%1'.").arg(error.data.type()));
|
||||
|
||||
if (error.data.type() == qstr("TAKEOUT_INVALID")) {
|
||||
showError(lang(lng_export_invalid));
|
||||
showError(tr::lng_export_invalid(tr::now));
|
||||
} else if (error.data.type().startsWith(qstr("TAKEOUT_INIT_DELAY_"))) {
|
||||
const auto seconds = std::max(error.data.type().mid(
|
||||
qstr("TAKEOUT_INIT_DELAY_").size()).toInt(), 1);
|
||||
@@ -200,7 +197,7 @@ void PanelController::showError(const ApiErrorState &error) {
|
||||
const auto hours = seconds / 3600;
|
||||
const auto hoursText = [&] {
|
||||
if (hours <= 0) {
|
||||
return lang(lng_export_delay_less_than_hour);
|
||||
return tr::lng_export_delay_less_than_hour(tr::now);
|
||||
}
|
||||
return lng_export_delay_hours(lt_count, hours);
|
||||
}();
|
||||
@@ -316,8 +313,8 @@ void PanelController::stopWithConfirmation(FnMut<void()> callback) {
|
||||
const auto hidden = _panel->isHidden();
|
||||
const auto old = _confirmStopBox;
|
||||
auto box = Box<ConfirmBox>(
|
||||
lang(lng_export_sure_stop),
|
||||
lang(lng_export_stop),
|
||||
tr::lng_export_sure_stop(tr::now),
|
||||
tr::lng_export_stop(tr::now),
|
||||
st::attentionBoxButton,
|
||||
std::move(stop));
|
||||
_confirmStopBox = box.data();
|
||||
|
@@ -245,7 +245,7 @@ ProgressWidget::ProgressWidget(
|
||||
_about = _body->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
this,
|
||||
lang(lng_export_progress),
|
||||
tr::lng_export_progress(tr::now),
|
||||
st::exportAboutLabel),
|
||||
st::exportAboutPadding);
|
||||
|
||||
@@ -307,13 +307,13 @@ void ProgressWidget::updateState(Content &&content) {
|
||||
|
||||
void ProgressWidget::showDone() {
|
||||
_cancel = nullptr;
|
||||
_about->setText(lang(lng_export_about_done));
|
||||
_about->setText(tr::lng_export_about_done(tr::now));
|
||||
_done = base::make_unique_q<Ui::RoundButton>(
|
||||
this,
|
||||
tr::lng_export_done(),
|
||||
st::exportDoneButton);
|
||||
const auto desired = std::min(
|
||||
st::exportDoneButton.font->width(lang(lng_export_done).toUpper())
|
||||
st::exportDoneButton.font->width(tr::lng_export_done(tr::now).toUpper())
|
||||
+ st::exportDoneButton.height
|
||||
- st::exportDoneButton.font->height,
|
||||
st::exportPanelSize.width() - 2 * st::exportCancelBottom);
|
||||
|
@@ -135,35 +135,38 @@ void SettingsWidget::setupFullExportOptions(
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
addOptionWithAbout(
|
||||
container,
|
||||
lng_export_option_info,
|
||||
tr::lng_export_option_info(tr::now),
|
||||
Type::PersonalInfo | Type::Userpics,
|
||||
lng_export_option_info_about);
|
||||
tr::lng_export_option_info_about(tr::now));
|
||||
addOptionWithAbout(
|
||||
container,
|
||||
lng_export_option_contacts,
|
||||
tr::lng_export_option_contacts(tr::now),
|
||||
Type::Contacts,
|
||||
lng_export_option_contacts_about);
|
||||
addHeader(container, lng_export_header_chats);
|
||||
tr::lng_export_option_contacts_about(tr::now));
|
||||
addHeader(container, tr::lng_export_header_chats(tr::now));
|
||||
addOption(
|
||||
container,
|
||||
lng_export_option_personal_chats,
|
||||
tr::lng_export_option_personal_chats(tr::now),
|
||||
Type::PersonalChats);
|
||||
addOption(container, lng_export_option_bot_chats, Type::BotChats);
|
||||
addOption(
|
||||
container,
|
||||
tr::lng_export_option_bot_chats(tr::now),
|
||||
Type::BotChats);
|
||||
addChatOption(
|
||||
container,
|
||||
lng_export_option_private_groups,
|
||||
tr::lng_export_option_private_groups(tr::now),
|
||||
Type::PrivateGroups);
|
||||
addChatOption(
|
||||
container,
|
||||
lng_export_option_private_channels,
|
||||
tr::lng_export_option_private_channels(tr::now),
|
||||
Type::PrivateChannels);
|
||||
addChatOption(
|
||||
container,
|
||||
lng_export_option_public_groups,
|
||||
tr::lng_export_option_public_groups(tr::now),
|
||||
Type::PublicGroups);
|
||||
addChatOption(
|
||||
container,
|
||||
lng_export_option_public_channels,
|
||||
tr::lng_export_option_public_channels(tr::now),
|
||||
Type::PublicChannels);
|
||||
}
|
||||
|
||||
@@ -178,7 +181,7 @@ void SettingsWidget::setupMediaOptions(
|
||||
container,
|
||||
object_ptr<Ui::VerticalLayout>(container)));
|
||||
const auto media = mediaWrap->entity();
|
||||
addHeader(media, lng_export_header_media);
|
||||
addHeader(media, tr::lng_export_header_media(tr::now));
|
||||
addMediaOptions(media);
|
||||
|
||||
value() | rpl::map([](const Settings &data) {
|
||||
@@ -201,17 +204,17 @@ void SettingsWidget::setupMediaOptions(
|
||||
|
||||
void SettingsWidget::setupOtherOptions(
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
addHeader(container, lng_export_header_other);
|
||||
addHeader(container, tr::lng_export_header_other(tr::now));
|
||||
addOptionWithAbout(
|
||||
container,
|
||||
lng_export_option_sessions,
|
||||
tr::lng_export_option_sessions(tr::now),
|
||||
Type::Sessions,
|
||||
lng_export_option_sessions_about);
|
||||
tr::lng_export_option_sessions_about(tr::now));
|
||||
addOptionWithAbout(
|
||||
container,
|
||||
lng_export_option_other,
|
||||
tr::lng_export_option_other(tr::now),
|
||||
Type::OtherData,
|
||||
lng_export_option_other_about);
|
||||
tr::lng_export_option_other_about(tr::now));
|
||||
}
|
||||
|
||||
void SettingsWidget::setupPathAndFormat(
|
||||
@@ -228,20 +231,20 @@ void SettingsWidget::setupPathAndFormat(
|
||||
data.format = format;
|
||||
});
|
||||
});
|
||||
const auto addFormatOption = [&](LangKey key, Format format) {
|
||||
const auto addFormatOption = [&](QString label, Format format) {
|
||||
const auto radio = container->add(
|
||||
object_ptr<Ui::Radioenum<Format>>(
|
||||
container,
|
||||
formatGroup,
|
||||
format,
|
||||
lang(key),
|
||||
label,
|
||||
st::defaultBoxCheckbox),
|
||||
st::exportSettingPadding);
|
||||
};
|
||||
addHeader(container, lng_export_header_format);
|
||||
addHeader(container, tr::lng_export_header_format(tr::now));
|
||||
addLocationLabel(container);
|
||||
addFormatOption(lng_export_option_html, Format::Html);
|
||||
addFormatOption(lng_export_option_json, Format::Json);
|
||||
addFormatOption(tr::lng_export_option_html(tr::now), Format::Html);
|
||||
addFormatOption(tr::lng_export_option_json(tr::now), Format::Json);
|
||||
}
|
||||
|
||||
void SettingsWidget::addLocationLabel(
|
||||
@@ -444,23 +447,23 @@ not_null<Ui::RpWidget*> SettingsWidget::setupButtons(
|
||||
|
||||
void SettingsWidget::addHeader(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey key) {
|
||||
const QString &text) {
|
||||
container->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
lang(key),
|
||||
text,
|
||||
st::exportHeaderLabel),
|
||||
st::exportHeaderPadding);
|
||||
}
|
||||
|
||||
not_null<Ui::Checkbox*> SettingsWidget::addOption(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey key,
|
||||
const QString &text,
|
||||
Types types) {
|
||||
const auto checkbox = container->add(
|
||||
object_ptr<Ui::Checkbox>(
|
||||
container,
|
||||
lang(key),
|
||||
text,
|
||||
((readData().types & types) == types),
|
||||
st::defaultBoxCheckbox),
|
||||
st::exportSettingPadding);
|
||||
@@ -479,14 +482,14 @@ not_null<Ui::Checkbox*> SettingsWidget::addOption(
|
||||
|
||||
not_null<Ui::Checkbox*> SettingsWidget::addOptionWithAbout(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey key,
|
||||
const QString &text,
|
||||
Types types,
|
||||
LangKey about) {
|
||||
const auto result = addOption(container, key, types);
|
||||
const QString &about) {
|
||||
const auto result = addOption(container, text, types);
|
||||
const auto label = container->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
lang(about),
|
||||
about,
|
||||
st::exportAboutOptionLabel),
|
||||
st::exportAboutOptionPadding);
|
||||
return result;
|
||||
@@ -494,15 +497,15 @@ not_null<Ui::Checkbox*> SettingsWidget::addOptionWithAbout(
|
||||
|
||||
void SettingsWidget::addChatOption(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey key,
|
||||
const QString &text,
|
||||
Types types) {
|
||||
const auto checkbox = addOption(container, key, types);
|
||||
const auto checkbox = addOption(container, text, types);
|
||||
const auto onlyMy = container->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::Checkbox>>(
|
||||
container,
|
||||
object_ptr<Ui::Checkbox>(
|
||||
container,
|
||||
lang(lng_export_option_only_my),
|
||||
tr::lng_export_option_only_my(tr::now),
|
||||
((readData().fullChats & types) != types),
|
||||
st::defaultBoxCheckbox),
|
||||
st::exportSubSettingPadding));
|
||||
@@ -528,36 +531,45 @@ void SettingsWidget::addChatOption(
|
||||
|
||||
void SettingsWidget::addMediaOptions(
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
addMediaOption(container, lng_export_option_photos, MediaType::Photo);
|
||||
addMediaOption(
|
||||
container,
|
||||
lng_export_option_video_files,
|
||||
tr::lng_export_option_photos(tr::now),
|
||||
MediaType::Photo);
|
||||
addMediaOption(
|
||||
container,
|
||||
tr::lng_export_option_video_files(tr::now),
|
||||
MediaType::Video);
|
||||
addMediaOption(
|
||||
container,
|
||||
lng_export_option_voice_messages,
|
||||
tr::lng_export_option_voice_messages(tr::now),
|
||||
MediaType::VoiceMessage);
|
||||
addMediaOption(
|
||||
container,
|
||||
lng_export_option_video_messages,
|
||||
tr::lng_export_option_video_messages(tr::now),
|
||||
MediaType::VideoMessage);
|
||||
addMediaOption(
|
||||
container,
|
||||
lng_export_option_stickers,
|
||||
tr::lng_export_option_stickers(tr::now),
|
||||
MediaType::Sticker);
|
||||
addMediaOption(container, lng_export_option_gifs, MediaType::GIF);
|
||||
addMediaOption(container, lng_export_option_files, MediaType::File);
|
||||
addMediaOption(
|
||||
container,
|
||||
tr::lng_export_option_gifs(tr::now),
|
||||
MediaType::GIF);
|
||||
addMediaOption(
|
||||
container,
|
||||
tr::lng_export_option_files(tr::now),
|
||||
MediaType::File);
|
||||
addSizeSlider(container);
|
||||
}
|
||||
|
||||
void SettingsWidget::addMediaOption(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey key,
|
||||
const QString &text,
|
||||
MediaType type) {
|
||||
const auto checkbox = container->add(
|
||||
object_ptr<Ui::Checkbox>(
|
||||
container,
|
||||
lang(key),
|
||||
text,
|
||||
((readData().media.types & type) == type),
|
||||
st::defaultBoxCheckbox),
|
||||
st::exportSettingPadding);
|
||||
@@ -675,7 +687,7 @@ void SettingsWidget::chooseFolder() {
|
||||
};
|
||||
FileDialog::GetFolder(
|
||||
this,
|
||||
lang(lng_export_folder),
|
||||
tr::lng_export_folder(tr::now),
|
||||
readData().path,
|
||||
callback);
|
||||
}
|
||||
|
@@ -10,8 +10,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "export/export_settings.h"
|
||||
#include "ui/rp_widget.h"
|
||||
|
||||
enum LangKey : int;
|
||||
|
||||
namespace Ui {
|
||||
class VerticalLayout;
|
||||
class Checkbox;
|
||||
@@ -55,24 +53,24 @@ private:
|
||||
void setupPathAndFormat(not_null<Ui::VerticalLayout*> container);
|
||||
void addHeader(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey key);
|
||||
const QString &text);
|
||||
not_null<Ui::Checkbox*> addOption(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey key,
|
||||
const QString &text,
|
||||
Types types);
|
||||
not_null<Ui::Checkbox*> addOptionWithAbout(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey key,
|
||||
const QString &text,
|
||||
Types types,
|
||||
LangKey about);
|
||||
const QString &about);
|
||||
void addChatOption(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey key,
|
||||
const QString &text,
|
||||
Types types);
|
||||
void addMediaOptions(not_null<Ui::VerticalLayout*> container);
|
||||
void addMediaOption(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey key,
|
||||
const QString &text,
|
||||
MediaType type);
|
||||
void addSizeSlider(not_null<Ui::VerticalLayout*> container);
|
||||
void addLocationLabel(
|
||||
|
@@ -41,7 +41,7 @@ void TopBar::updateData(Content &&content) {
|
||||
const auto &row = content.rows[0];
|
||||
const auto clean = &TextUtilities::Clean;
|
||||
_info->setRichText(textcmdStartSemibold()
|
||||
+ clean(lang(lng_export_progress_title))
|
||||
+ clean(tr::lng_export_progress_title(tr::now))
|
||||
+ textcmdStopSemibold()
|
||||
+ QString::fromUtf8(" \xe2\x80\x93 ")
|
||||
+ clean(row.label)
|
||||
|
Reference in New Issue
Block a user