From 0c4bda71fd8a1736f60923de12181b8e245af412 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 28 Sep 2017 23:11:10 +0300 Subject: [PATCH] Remove some unused / rare phrases. --- Telegram/Resources/langs/lang.strings | 18 -------- Telegram/SourceFiles/apiwrap.cpp | 2 +- .../SourceFiles/boxes/change_phone_box.cpp | 8 ++-- .../SourceFiles/boxes/confirm_phone_box.cpp | 4 +- .../SourceFiles/boxes/local_storage_box.cpp | 2 +- Telegram/SourceFiles/boxes/passcode_box.cpp | 2 +- Telegram/SourceFiles/calls/calls_call.cpp | 4 +- .../SourceFiles/chat_helpers/stickers.cpp | 2 +- .../chat_helpers/stickers_list_widget.cpp | 2 +- Telegram/SourceFiles/facades.h | 1 + Telegram/SourceFiles/history/history.cpp | 4 +- .../SourceFiles/history/history_service.cpp | 9 +++- .../inline_bots/inline_results_widget.cpp | 6 --- Telegram/SourceFiles/intro/introcode.cpp | 8 ++-- Telegram/SourceFiles/intro/introphone.cpp | 4 +- Telegram/SourceFiles/intro/intropwdcheck.cpp | 6 +-- Telegram/SourceFiles/intro/introsignup.cpp | 4 +- Telegram/SourceFiles/intro/introwidget.cpp | 2 +- Telegram/SourceFiles/lang/lang_hardcoded.h | 43 +++++++++++++++++++ Telegram/SourceFiles/lang/lang_keys.h | 1 + .../profile/profile_block_actions.cpp | 7 --- .../settings_chat_settings_widget.cpp | 2 +- .../SourceFiles/storage/localimageloader.cpp | 9 +--- Telegram/SourceFiles/storage/localstorage.cpp | 2 +- Telegram/gyp/telegram_sources.txt | 1 + 25 files changed, 84 insertions(+), 69 deletions(-) create mode 100644 Telegram/SourceFiles/lang/lang_hardcoded.h diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 064a89de0..60be6d1a6 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -122,7 +122,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_channel_admins_link#one" = "{count} administrator"; "lng_channel_admins_link#other" = "{count} administrators"; -"lng_server_error" = "Internal server error."; "lng_flood_error" = "Too many tries. Please try again later."; "lng_gif_error" = "An error has occurred while reading GIF animation :("; "lng_edit_error" = "You cannot edit this message"; @@ -343,7 +342,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_download_finish_failed" = "File download could not be finished.\n\nWould you like to try again?"; "lng_download_path_clearing" = "Clearing..."; "lng_download_path_cleared" = "Cleared!"; -"lng_download_path_clear_failed" = "Clear failed :("; "lng_settings_section_privacy" = "Privacy and Security"; @@ -356,7 +354,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_local_storage_clear" = "Clear all"; "lng_local_storage_clearing" = "Clearing..."; "lng_local_storage_cleared" = "Cleared!"; -"lng_local_storage_clear_failed" = "Clear failed :("; "lng_settings_section_advanced_settings" = "Advanced Settings"; "lng_settings_enable_night_theme" = "Enable night mode"; @@ -444,7 +441,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_settings_reset_sure" = "Are you sure you want to terminate\nall other sessions?"; "lng_settings_reset_one_sure" = "Do you want to terminate this session?"; "lng_settings_reset_button" = "Terminate"; -"lng_settings_reset_done" = "Other sessions terminated"; "lng_settings_manage_local_storage" = "Manage local storage"; "lng_settings_ask_question" = "Ask a Question"; "lng_settings_ask_sure" = "Please note that Telegram Support is done by volunteers. We try to respond as quickly as possible, but it may take a while.\n\nPlease take a look at the Telegram FAQ: it has important troubleshooting tips and answers to most questions."; @@ -459,7 +455,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_sessions_header" = "Current session"; "lng_sessions_other_header" = "Active sessions"; -"lng_sessions_no_other" = "No other sessions"; "lng_sessions_other_desc" = "You can log in to Telegram from other mobile, tablet and desktop devices, using the same phone number. All your data will be instantly synchronized."; "lng_sessions_terminate_all" = "Terminate all other sessions"; @@ -724,7 +719,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_action_add_you" = "{from} added you to this channel"; "lng_action_you_joined" = "You joined this channel"; "lng_action_add_you_group" = "{from} added you to this group"; -"lng_action_you_joined_group" = "You joined this group"; "lng_action_kick_user" = "{from} removed {user}"; "lng_action_user_left" = "{from} left the group"; "lng_action_user_joined" = "{from} joined the group"; @@ -825,7 +819,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_cancel_edit_post_no" = "No"; "lng_bot_share_location_unavailable" = "Sorry, the location sharing is currently unavailable in Telegram Desktop."; -"lng_bot_inline_geo_unavailable" = "Sorry, this bot requires location sharing.\nIt is not available in Telegram Desktop."; "lng_bot_share_phone" = "Share Phone Number?"; "lng_bot_share_phone_confirm" = "Share"; @@ -860,7 +853,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_emoji_hide_panel" = "Click here to hide the emoji sidebar"; "lng_recent_stickers" = "Frequently used"; -"lng_faved_stickers" = "Favorite stickers"; "lng_faved_stickers_add" = "Add to Favorites"; "lng_faved_stickers_remove" = "Remove from Favorites"; "lng_group_stickers" = "Group stickers"; @@ -923,10 +915,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_cant_invite_banned" = "Sorry, only admin can add this user."; "lng_cant_invite_privacy" = "Sorry, you cannot add this user to groups because of their privacy settings."; "lng_cant_invite_privacy_channel" = "Sorry, you cannot add this user to channels because of their privacy settings."; -"lng_cant_delete_group#one" = "Sorry, it is currently not possible to manually delete communities that have more than {count} member. Please contact Telegram support if you would like to delete this group."; -"lng_cant_delete_group#other" = "Sorry, it is currently not possible to manually delete communities that have more than {count} members. Please contact Telegram support if you would like to delete this group."; -"lng_cant_delete_channel#one" = "Sorry, it is currently not possible to manually delete communities that have more than {count} member. Please contact Telegram support if you would like to delete this channel."; -"lng_cant_delete_channel#other" = "Sorry, it is currently not possible to manually delete communities that have more than {count} members. Please contact Telegram support if you would like to delete this channel."; "lng_cant_do_this" = "Sorry, this action is unavailable."; "lng_send_button" = "Send"; @@ -995,10 +983,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_user_action_upload_photo" = "{user} is sending a photo"; "lng_send_action_upload_file" = "sending a file"; "lng_user_action_upload_file" = "{user} is sending a file"; -"lng_send_action_geo_location" = "picking a location"; -"lng_user_action_geo_location" = "{user} is picking a location"; -"lng_send_action_choose_contact" = "choosing a contact"; -"lng_user_action_choose_contact" = "{user} is choosing a contact"; "lng_unread_bar#one" = "{count} unread message"; "lng_unread_bar#other" = "{count} unread messages"; @@ -1064,7 +1048,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_send_images_compress#other" = "Compress images"; "lng_send_image_empty" = "Could not send an empty file: {name}"; "lng_send_image_too_large" = "Could not send a file, because it is larger than 1500 MB: {name}"; -"lng_send_folder" = "Could not send «{name}» because it is a directory :("; "lng_send_images_selected#one" = "{count} image selected"; "lng_send_images_selected#other" = "{count} images selected"; "lng_send_photos#one" = "Send {count} photo"; @@ -1239,7 +1222,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_call_fingerprint_tooltip" = "If emoji on {user}'s screen are the same, this call is 100% secure"; "lng_call_error_not_available" = "Sorry, {user} doesn't accept calls."; -"lng_call_error_incompatible" = "{user}'s app is using an incompatible protocol. They need to update their app before you can call them."; "lng_call_error_outdated" = "{user}'s app does not support calls. They need to update their app before you can call them."; "lng_call_error_audio_io" = "There seems to be a problem with audio playback on your computer. Please make sure that your computer's speakers and microphone are working and try again."; diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 3a6b73253..70e58393f 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -1552,7 +1552,7 @@ void ApiWrap::requestFavedStickers(TimeId now) { case mtpc_messages_favedStickersNotModified: return; case mtpc_messages_favedStickers: { auto &d = result.c_messages_favedStickers(); - Stickers::SpecialSetReceived(Stickers::FavedSetId, lang(lng_faved_stickers), d.vstickers.v, d.vhash.v, d.vpacks.v); + Stickers::SpecialSetReceived(Stickers::FavedSetId, Lang::Hard::FavedSetTitle(), d.vstickers.v, d.vhash.v, d.vpacks.v); } return; default: Unexpected("Type in ApiWrap::favedStickersDone()"); } diff --git a/Telegram/SourceFiles/boxes/change_phone_box.cpp b/Telegram/SourceFiles/boxes/change_phone_box.cpp index 3a97b8988..eaa37ead1 100644 --- a/Telegram/SourceFiles/boxes/change_phone_box.cpp +++ b/Telegram/SourceFiles/boxes/change_phone_box.cpp @@ -167,13 +167,13 @@ void ChangePhoneBox::EnterPhone::sendPhoneDone(const QString &phoneNumber, const switch (data.vtype.type()) { case mtpc_auth_sentCodeTypeApp: LOG(("Error: should not be in-app code!")); - showError(lang(lng_server_error)); + showError(Lang::Hard::ServerError()); return; case mtpc_auth_sentCodeTypeSms: codeLength = data.vtype.c_auth_sentCodeTypeSms().vlength.v; break; case mtpc_auth_sentCodeTypeCall: codeLength = data.vtype.c_auth_sentCodeTypeCall().vlength.v; break; case mtpc_auth_sentCodeTypeFlashCall: LOG(("Error: should not be flashcall!")); - showError(lang(lng_server_error)); + showError(Lang::Hard::ServerError()); return; } auto phoneCodeHash = qs(data.vphone_code_hash); @@ -191,7 +191,7 @@ void ChangePhoneBox::EnterPhone::sendPhoneDone(const QString &phoneNumber, const } bool ChangePhoneBox::EnterPhone::sendPhoneFail(const QString &phoneNumber, const RPCError &error) { - auto errorText = lang(lng_server_error); + auto errorText = Lang::Hard::ServerError(); if (MTP::isFloodError(error)) { errorText = lang(lng_flood_error); } else if (MTP::isDefaultHandledError(error)) { @@ -300,7 +300,7 @@ void ChangePhoneBox::EnterCode::showError(const QString &text) { } bool ChangePhoneBox::EnterCode::sendCodeFail(const RPCError &error) { - auto errorText = lang(lng_server_error); + auto errorText = Lang::Hard::ServerError(); if (MTP::isFloodError(error)) { errorText = lang(lng_flood_error); } else if (MTP::isDefaultHandledError(error)) { diff --git a/Telegram/SourceFiles/boxes/confirm_phone_box.cpp b/Telegram/SourceFiles/boxes/confirm_phone_box.cpp index 1b2724198..e1e8304e6 100644 --- a/Telegram/SourceFiles/boxes/confirm_phone_box.cpp +++ b/Telegram/SourceFiles/boxes/confirm_phone_box.cpp @@ -176,7 +176,7 @@ void ConfirmPhoneBox::sendCodeDone(const MTPauth_SentCode &result) { } bool ConfirmPhoneBox::sendCodeFail(const RPCError &error) { - auto errorText = lang(lng_server_error); + auto errorText = Lang::Hard::ServerError(); if (MTP::isFloodError(error)) { errorText = lang(lng_flood_error); } else if (MTP::isDefaultHandledError(error)) { @@ -254,7 +254,7 @@ void ConfirmPhoneBox::confirmDone(const MTPBool &result) { } bool ConfirmPhoneBox::confirmFail(const RPCError &error) { - auto errorText = lang(lng_server_error); + auto errorText = Lang::Hard::ServerError(); if (MTP::isFloodError(error)) { errorText = lang(lng_flood_error); } else if (MTP::isDefaultHandledError(error)) { diff --git a/Telegram/SourceFiles/boxes/local_storage_box.cpp b/Telegram/SourceFiles/boxes/local_storage_box.cpp index c6462715b..ece7186e1 100644 --- a/Telegram/SourceFiles/boxes/local_storage_box.cpp +++ b/Telegram/SourceFiles/boxes/local_storage_box.cpp @@ -100,7 +100,7 @@ void LocalStorageBox::paintEvent(QPaintEvent *e) { switch (_state) { case State::Clearing: return lang(lng_local_storage_clearing); case State::Cleared: return lang(lng_local_storage_cleared); - case State::ClearFailed: return lang(lng_local_storage_clear_failed); + case State::ClearFailed: return Lang::Hard::ClearPathFailed(); } return QString(); })(); diff --git a/Telegram/SourceFiles/boxes/passcode_box.cpp b/Telegram/SourceFiles/boxes/passcode_box.cpp index 53e1a8574..2089ae887 100644 --- a/Telegram/SourceFiles/boxes/passcode_box.cpp +++ b/Telegram/SourceFiles/boxes/passcode_box.cpp @@ -525,7 +525,7 @@ bool RecoverBox::codeSubmitFail(const RPCError &error) { if (cDebug()) { // internal server error _error = err + ": " + error.description(); } else { - _error = lang(lng_server_error); + _error = Lang::Hard::ServerError(); } update(); _recoverCode->setFocus(); diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp index 767403110..4d436b4e1 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp @@ -661,14 +661,14 @@ void Call::handleRequestError(const RPCError &error) { } else if (error.type() == qstr("PARTICIPANT_VERSION_OUTDATED")) { Ui::show(Box(lng_call_error_outdated(lt_user, App::peerName(_user)))); } else if (error.type() == qstr("CALL_PROTOCOL_LAYER_INVALID")) { - Ui::show(Box(lng_call_error_incompatible(lt_user, App::peerName(_user)))); + Ui::show(Box(Lang::Hard::CallErrorIncompatible().replace("{user}", App::peerName(_user)))); } finish(FinishType::Failed); } void Call::handleControllerError(int error) { if (error == TGVOIP_ERROR_INCOMPATIBLE) { - Ui::show(Box(lng_call_error_incompatible(lt_user, App::peerName(_user)))); + Ui::show(Box(Lang::Hard::CallErrorIncompatible().replace("{user}", App::peerName(_user)))); } else if (error == TGVOIP_ERROR_AUDIO_IO) { Ui::show(Box(lang(lng_call_error_audio_io))); } diff --git a/Telegram/SourceFiles/chat_helpers/stickers.cpp b/Telegram/SourceFiles/chat_helpers/stickers.cpp index d422d7bdd..3fead9c56 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers.cpp @@ -245,7 +245,7 @@ void SetIsFaved(not_null document, base::optionalstickers.indexOf(document); if (index == 0) { diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index dce205bad..671ef4b2f 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -1290,7 +1290,7 @@ void StickersListWidget::refreshFavedStickers() { if (it == sets.cend() || it->stickers.isEmpty()) { return; } - _mySets.push_back(Set(Stickers::FavedSetId, MTPDstickerSet::Flag::f_official | MTPDstickerSet_ClientFlag::f_special, lang(lng_faved_stickers), it->stickers.size() * 2, it->stickers)); + _mySets.push_back(Set(Stickers::FavedSetId, MTPDstickerSet::Flag::f_official | MTPDstickerSet_ClientFlag::f_special, Lang::Hard::FavedSetTitle(), it->stickers.size() * 2, it->stickers)); _favedStickersMap = base::flat_set> { it->stickers.begin(), it->stickers.end() }; } diff --git a/Telegram/SourceFiles/facades.h b/Telegram/SourceFiles/facades.h index e00987161..25d0e8380 100644 --- a/Telegram/SourceFiles/facades.h +++ b/Telegram/SourceFiles/facades.h @@ -281,6 +281,7 @@ constexpr auto CloudRecentSetId = 0xFFFFFFFFFFFFFFFCULL; // for cloud-stored rec constexpr auto FeaturedSetId = 0xFFFFFFFFFFFFFFFBULL; // for emoji/stickers panel, should not appear in Sets constexpr auto FavedSetId = 0xFFFFFFFFFFFFFFFAULL; // for cloud-stored faved stickers constexpr auto MegagroupSetId = 0xFFFFFFFFFFFFFFEFULL; // for setting up megagroup sticker set + struct Set { Set(uint64 id, uint64 access, const QString &title, const QString &shortName, int32 count, int32 hash, MTPDstickerSet::Flags flags) : id(id) diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index be6cbc8ff..802b2faf8 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -343,8 +343,8 @@ bool History::updateSendActionNeedsAnimating(TimeMs ms, bool force) { case Type::UploadRound: return name.isEmpty() ? lang(lng_send_action_upload_round) : lng_user_action_upload_round(lt_user, name); case Type::UploadPhoto: return name.isEmpty() ? lang(lng_send_action_upload_photo) : lng_user_action_upload_photo(lt_user, name); case Type::UploadFile: return name.isEmpty() ? lang(lng_send_action_upload_file) : lng_user_action_upload_file(lt_user, name); - case Type::ChooseLocation: return name.isEmpty() ? lang(lng_send_action_geo_location) : lng_user_action_geo_location(lt_user, name); - case Type::ChooseContact: return name.isEmpty() ? lang(lng_send_action_choose_contact) : lng_user_action_choose_contact(lt_user, name); + case Type::ChooseLocation: + case Type::ChooseContact: return name.isEmpty() ? lang(lng_typing) : lng_user_typing(lt_user, name); default: break; }; return QString(); diff --git a/Telegram/SourceFiles/history/history_service.cpp b/Telegram/SourceFiles/history/history_service.cpp index 7f81739aa..b421e1854 100644 --- a/Telegram/SourceFiles/history/history_service.cpp +++ b/Telegram/SourceFiles/history/history_service.cpp @@ -786,7 +786,14 @@ HistoryJoined::HistoryJoined(not_null history, const QDateTime &invite HistoryJoined::PreparedText HistoryJoined::GenerateText(not_null history, not_null inviter) { if (inviter->id == Auth().userPeerId()) { - return { lang(history->isMegagroup() ? lng_action_you_joined_group : lng_action_you_joined) }; + if (history->isMegagroup()) { + auto self = App::user(Auth().userPeerId()); + auto result = PreparedText {}; + result.links.push_back(self->createOpenLink()); + result.text = lng_action_user_joined(lt_from, textcmdLink(1, self->name)); + return result; + } + return { lang(lng_action_you_joined) }; } auto result = PreparedText {}; result.links.push_back(inviter->createOpenLink()); diff --git a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp index 7f93b0576..e82a72080 100644 --- a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp @@ -1066,13 +1066,7 @@ void Widget::queryInlineBot(UserData *bot, PeerData *peer, QString query) { inlineBotChanged(); _inlineBot = bot; force = true; - //if (_inlineBot->isBotInlineGeo()) { - // Ui::show(Box(lang(lng_bot_inline_geo_unavailable))); - //} } - //if (_inlineBot && _inlineBot->isBotInlineGeo()) { - // return; - //} if (_inlineQuery != query || force) { if (_inlineRequestId) { diff --git a/Telegram/SourceFiles/intro/introcode.cpp b/Telegram/SourceFiles/intro/introcode.cpp index 42d411e2c..71b7eb75d 100644 --- a/Telegram/SourceFiles/intro/introcode.cpp +++ b/Telegram/SourceFiles/intro/introcode.cpp @@ -220,7 +220,7 @@ void CodeWidget::codeSubmitDone(const MTPauth_Authorization &result) { _sentRequest = 0; auto &d = result.c_auth_authorization(); if (d.vuser.type() != mtpc_user || !d.vuser.c_user().is_self()) { // wtf? - showCodeError(langFactory(lng_server_error)); + showCodeError(&Lang::Hard::ServerError); return; } cSetLoggedPhoneNumber(getData()->phone); @@ -259,7 +259,7 @@ bool CodeWidget::codeSubmitFail(const RPCError &error) { auto text = err + ": " + error.description(); showCodeError([text] { return text; }); } else { - showCodeError(langFactory(lng_server_error)); + showCodeError(&Lang::Hard::ServerError); } return false; } @@ -337,7 +337,7 @@ void CodeWidget::onNoTelegramCode() { void CodeWidget::noTelegramCodeDone(const MTPauth_SentCode &result) { if (result.type() != mtpc_auth_sentCode) { - showCodeError(langFactory(lng_server_error)); + showCodeError(&Lang::Hard::ServerError); return; } @@ -366,7 +366,7 @@ bool CodeWidget::noTelegramCodeFail(const RPCError &error) { auto text = error.type() + ": " + error.description(); showCodeError([text] { return text; }); } else { - showCodeError(langFactory(lng_server_error)); + showCodeError(&Lang::Hard::ServerError); } return false; } diff --git a/Telegram/SourceFiles/intro/introphone.cpp b/Telegram/SourceFiles/intro/introphone.cpp index 85f8d97b5..f5241c0ec 100644 --- a/Telegram/SourceFiles/intro/introphone.cpp +++ b/Telegram/SourceFiles/intro/introphone.cpp @@ -172,7 +172,7 @@ void PhoneWidget::phoneSubmitDone(const MTPauth_SentCode &result) { _sentRequest = 0; if (result.type() != mtpc_auth_sentCode) { - showPhoneError(langFactory(lng_server_error)); + showPhoneError(&Lang::Hard::ServerError); return; } @@ -222,7 +222,7 @@ bool PhoneWidget::phoneSubmitFail(const RPCError &error) { auto text = err + ": " + error.description(); showPhoneError([text] { return text; }); } else { - showPhoneError(langFactory(lng_server_error)); + showPhoneError(&Lang::Hard::ServerError); } return false; } diff --git a/Telegram/SourceFiles/intro/intropwdcheck.cpp b/Telegram/SourceFiles/intro/intropwdcheck.cpp index 4748e5df4..e4a920127 100644 --- a/Telegram/SourceFiles/intro/intropwdcheck.cpp +++ b/Telegram/SourceFiles/intro/intropwdcheck.cpp @@ -136,7 +136,7 @@ void PwdCheckWidget::pwdSubmitDone(bool recover, const MTPauth_Authorization &re } auto &d = result.c_auth_authorization(); if (d.vuser.type() != mtpc_user || !d.vuser.c_user().is_self()) { // wtf? - showError(langFactory(lng_server_error)); + showError(&Lang::Hard::ServerError); return; } finish(d.vuser); @@ -167,7 +167,7 @@ bool PwdCheckWidget::pwdSubmitFail(const RPCError &error) { auto text = err + ": " + error.description(); showError([text] { return text; }); } else { - showError(langFactory(lng_server_error)); + showError(&Lang::Hard::ServerError); } _pwdField->setFocus(); return false; @@ -204,7 +204,7 @@ bool PwdCheckWidget::codeSubmitFail(const RPCError &error) { auto text = err + ": " + error.description(); showError([text] { return text; }); } else { - showError(langFactory(lng_server_error)); + showError(&Lang::Hard::ServerError); } _codeField->setFocus(); return false; diff --git a/Telegram/SourceFiles/intro/introsignup.cpp b/Telegram/SourceFiles/intro/introsignup.cpp index a655d52e5..dc3a91b1d 100644 --- a/Telegram/SourceFiles/intro/introsignup.cpp +++ b/Telegram/SourceFiles/intro/introsignup.cpp @@ -161,7 +161,7 @@ void SignupWidget::nameSubmitDone(const MTPauth_Authorization &result) { stopCheck(); auto &d = result.c_auth_authorization(); if (d.vuser.type() != mtpc_user || !d.vuser.c_user().is_self()) { // wtf? - showError(langFactory(lng_server_error)); + showError(&Lang::Hard::ServerError); return; } finish(d.vuser, _photoImage); @@ -203,7 +203,7 @@ bool SignupWidget::nameSubmitFail(const RPCError &error) { auto text = err + ": " + error.description(); showError([text] { return text; }); } else { - showError(langFactory(lng_server_error)); + showError(&Lang::Hard::ServerError); } if (_invertOrder) { _last->setFocus(); diff --git a/Telegram/SourceFiles/intro/introwidget.cpp b/Telegram/SourceFiles/intro/introwidget.cpp index 1d88b85e9..30d5f4fe0 100644 --- a/Telegram/SourceFiles/intro/introwidget.cpp +++ b/Telegram/SourceFiles/intro/introwidget.cpp @@ -289,7 +289,7 @@ void Widget::resetAccount() { Ui::show(Box(lang(lng_signin_reset_cancelled))); } else { Ui::hideLayer(); - getStep()->showError(langFactory(lng_server_error)); + getStep()->showError(&Lang::Hard::ServerError); } }).send(); }))); diff --git a/Telegram/SourceFiles/lang/lang_hardcoded.h b/Telegram/SourceFiles/lang/lang_hardcoded.h new file mode 100644 index 000000000..e2b7e5ad8 --- /dev/null +++ b/Telegram/SourceFiles/lang/lang_hardcoded.h @@ -0,0 +1,43 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org +*/ +#pragma once + +namespace Lang { +namespace Hard { + +inline QString FavedSetTitle() { + return qsl("Favorite stickers"); +} + +inline QString CallErrorIncompatible() { + return qsl("{user}'s app is using an incompatible protocol. They need to update their app before you can call them."); +} + +inline QString ServerError() { + return qsl("Internal server error."); +} + +inline QString ClearPathFailed() { + return qsl("Clear failed :("); +} + +} // namespace Hard +} // namespace Lang diff --git a/Telegram/SourceFiles/lang/lang_keys.h b/Telegram/SourceFiles/lang/lang_keys.h index 550224ecf..f0d8546fc 100644 --- a/Telegram/SourceFiles/lang/lang_keys.h +++ b/Telegram/SourceFiles/lang/lang_keys.h @@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #pragma once #include "lang/lang_instance.h" +#include "lang/lang_hardcoded.h" inline QString lang(LangKey key) { return Lang::Current().getValue(key); diff --git a/Telegram/SourceFiles/profile/profile_block_actions.cpp b/Telegram/SourceFiles/profile/profile_block_actions.cpp index 916d6c34d..19683a553 100644 --- a/Telegram/SourceFiles/profile/profile_block_actions.cpp +++ b/Telegram/SourceFiles/profile/profile_block_actions.cpp @@ -337,13 +337,6 @@ void ActionsWidget::onUpgradeToSupergroup() { } void ActionsWidget::onDeleteChannel() { - if (auto channel = peer()->asChannel()) { - if (channel->membersCount() > kMaxChannelMembersDeleteAllowed) { - Ui::show(Box((channel->isMegagroup() ? lng_cant_delete_group : lng_cant_delete_channel)(lt_count, kMaxChannelMembersDeleteAllowed))); - return; - } - } - auto text = lang(peer()->isMegagroup() ? lng_sure_delete_group : lng_sure_delete_channel); Ui::show(Box(text, lang(lng_box_delete), st::attentionBoxButton, base::lambda_guarded(this, [this] { Ui::hideLayer(); diff --git a/Telegram/SourceFiles/settings/settings_chat_settings_widget.cpp b/Telegram/SourceFiles/settings/settings_chat_settings_widget.cpp index 113afbab7..a69a298b2 100644 --- a/Telegram/SourceFiles/settings/settings_chat_settings_widget.cpp +++ b/Telegram/SourceFiles/settings/settings_chat_settings_widget.cpp @@ -90,7 +90,7 @@ void DownloadPathState::paintEvent(QPaintEvent *e) { switch (_state) { case State::Clearing: return lang(lng_download_path_clearing); case State::Cleared: return lang(lng_download_path_cleared); - case State::ClearFailed: return lang(lng_download_path_clear_failed); + case State::ClearFailed: return Lang::Hard::ClearPathFailed(); } return QString(); })(); diff --git a/Telegram/SourceFiles/storage/localimageloader.cpp b/Telegram/SourceFiles/storage/localimageloader.cpp index a18f8fa3a..e2528adf1 100644 --- a/Telegram/SourceFiles/storage/localimageloader.cpp +++ b/Telegram/SourceFiles/storage/localimageloader.cpp @@ -574,17 +574,10 @@ void FileLoadTask::process() { } void FileLoadTask::finish() { - if (!_result || !_result->filesize) { + if (!_result || !_result->filesize || _result->filesize < 0) { Ui::show( Box(lng_send_image_empty(lt_name, _filepath)), LayerOption::KeepOther); - } else if (_result->filesize == -1) { // dir - Ui::show( - Box( - lng_send_folder( - lt_name, - QFileInfo(_filepath).dir().dirName())), - LayerOption::KeepOther); } else if (_result->filesize > App::kFileSizeLimit) { Ui::show( Box( diff --git a/Telegram/SourceFiles/storage/localstorage.cpp b/Telegram/SourceFiles/storage/localstorage.cpp index 57e63196f..a53b5bed5 100644 --- a/Telegram/SourceFiles/storage/localstorage.cpp +++ b/Telegram/SourceFiles/storage/localstorage.cpp @@ -3358,7 +3358,7 @@ void _readStickerSets(FileKey &stickersKey, Stickers::Order *outOrder = nullptr, setTitle = lang(lng_recent_stickers); setFlags |= MTPDstickerSet_ClientFlag::f_special; } else if (setId == Stickers::FavedSetId) { - setTitle = lang(lng_faved_stickers); + setTitle = Lang::Hard::FavedSetTitle(); setFlags |= MTPDstickerSet_ClientFlag::f_special; } else if (setId) { if (readingInstalled && outOrder && stickers.version < 9061) { diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt index 8117c7b2e..dfd6b606b 100644 --- a/Telegram/gyp/telegram_sources.txt +++ b/Telegram/gyp/telegram_sources.txt @@ -269,6 +269,7 @@ <(src_loc)/lang/lang_cloud_manager.h <(src_loc)/lang/lang_file_parser.cpp <(src_loc)/lang/lang_file_parser.h +<(src_loc)/lang/lang_hardcoded.h <(src_loc)/lang/lang_instance.cpp <(src_loc)/lang/lang_instance.h <(src_loc)/lang/lang_keys.cpp