From 03337cdec721b9e789d0e92ffb5d340b1b5ea335 Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Wed, 10 Aug 2022 01:36:41 +0300 Subject: [PATCH] [Branding] App name (language-dependent) --- Telegram/Resources/langs/rewrites/en.json | 26 +++++++++++ Telegram/SourceFiles/api/api_bot.cpp | 3 +- Telegram/SourceFiles/boxes/about_box.cpp | 43 +++++++++++++------ Telegram/SourceFiles/boxes/connection_box.cpp | 3 +- .../SourceFiles/boxes/download_path_box.cpp | 3 +- Telegram/SourceFiles/boxes/passcode_box.cpp | 3 +- Telegram/SourceFiles/calls/calls_instance.cpp | 3 +- .../SourceFiles/data/data_cloud_themes.cpp | 5 ++- .../SourceFiles/dialogs/dialogs_widget.cpp | 3 +- .../export/view/export_view_progress.cpp | 3 +- .../history/history_item_helpers.cpp | 5 ++- Telegram/SourceFiles/intro/intro_code.cpp | 3 +- Telegram/SourceFiles/intro/intro_start.cpp | 5 ++- .../SourceFiles/lang/lang_cloud_manager.cpp | 9 ++-- .../passport/passport_panel_controller.cpp | 3 +- .../platform/mac/main_window_mac.mm | 3 +- .../SourceFiles/platform/win/tray_win.cpp | 3 +- .../settings/settings_advanced.cpp | 9 ++-- .../SourceFiles/settings/settings_calls.cpp | 3 +- .../settings/settings_privacy_security.cpp | 3 +- Telegram/SourceFiles/tray.cpp | 5 ++- .../ui/controls/window_outdated_bar.cpp | 5 ++- .../window/themes/window_theme_editor.cpp | 3 +- 23 files changed, 108 insertions(+), 46 deletions(-) diff --git a/Telegram/Resources/langs/rewrites/en.json b/Telegram/Resources/langs/rewrites/en.json index e58768fe8..facc7406c 100644 --- a/Telegram/Resources/langs/rewrites/en.json +++ b/Telegram/Resources/langs/rewrites/en.json @@ -1,3 +1,29 @@ { + "ktg_intro_about": "Welcome to unofficial messaging app\nbased on Telegram Desktop.", + "ktg_about_text1": "Experimental unofficial {tdesktop_link} fork.", + "ktg_about_text1_tdesktop": "Telegram Desktop", + "ktg_about_text3": "Visit {channel_link} or {faq_link} for more info.", + "ktg_about_text3_channel": "Kotatogram channel", + "ktg_open_from_tray": "Open Kotatogram", + "ktg_quit_from_tray": "Quit Kotatogram", + "ktg_tray_icon_text": "Kotatogram is still running here,\nyou can change this from settings page.\nIf this icon disappears from tray menu,\nyou can drag it here from hidden icons.", + "ktg_error_start_minimized_passcoded": "You have set a local passcode, so Kotatogram Desktop can't be launched minimised; it will ask you to enter your passcode before it can start working.", + "ktg_proxy_unsupported": "Your Kotatogram Desktop version doesn't support this proxy type or the proxy link is invalid. Please update Kotatogram Desktop to the latest version.", + "ktg_update_telegram": "Update Kotatogram", + "ktg_settings_auto_start": "Launch Kotatogram when system starts", + "ktg_settings_add_sendto": "Place Kotatogram in \"Send to\" menu", + "ktg_theme_no_desktop": "Sorry, this theme doesn't include a version for Kotatogram Desktop.", + "ktg_download_path_default_radio": "Kotatogram folder in system «Downloads»", + "ktg_passcode_about": "When a local passcode is set, a lock icon appears at the top of your chats list. Click it to lock the app.\n\nNote: if you forget your local passcode, you'll need to relogin in Kotatogram Desktop.", + "ktg_message_unsupported": "This message is not supported by your version of Kotatogram Desktop. Please update to the latest version in Settings, or install it from {link}", + "ktg_bot_share_location_unavailable": "Sorry, location sharing is currently unavailable in Kotatogram Desktop.", + "ktg_theme_editor_need_unlock": "You need to unlock Kotatogram to save your theme.", + "ktg_no_mic_permission": "Kotatogram needs access to your microphone so that you can make calls and record voice messages.", + "ktg_passport_app_out_of_date": "Sorry, your Telegram app is out of date and can't handle this request. Please update Kotatogram.", + "ktg_export_progress": "You can close this window now. Please don't quit Kotatogram until the data export is completed.", + "ktg_language_not_ready_about": "Unfortunately, this custom language pack ({lang_name}) doesn't contain data for Kotatogram Desktop. You can contribute to this language pack using the {link}.", + "ktg_outdated_soon": "Otherwise, Kotatogram Desktop will stop updating on {date}.", + "ktg_outdated_now": "So that Kotatogram Desktop can update to newer versions.", + "ktg_mac_menu_show": "Show Kotatogram", "dummy_last_string": "" } diff --git a/Telegram/SourceFiles/api/api_bot.cpp b/Telegram/SourceFiles/api/api_bot.cpp index 0284ae719..862bf5a45 100644 --- a/Telegram/SourceFiles/api/api_bot.cpp +++ b/Telegram/SourceFiles/api/api_bot.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "api/api_bot.h" +#include "kotato/kotato_lang.h" #include "apiwrap.h" #include "api/api_cloud_password.h" #include "api/api_send_progress.h" @@ -357,7 +358,7 @@ void ActivateBotCommand(ClickHandlerContext context, int row, int column) { case ButtonType::RequestLocation: { HideSingleUseKeyboard(controller, item); controller->show( - Ui::MakeInformBox(tr::lng_bot_share_location_unavailable())); + Ui::MakeInformBox(rktr("ktg_bot_share_location_unavailable"))); } break; case ButtonType::RequestPhone: { diff --git a/Telegram/SourceFiles/boxes/about_box.cpp b/Telegram/SourceFiles/boxes/about_box.cpp index 6d001d407..d3ea42ff1 100644 --- a/Telegram/SourceFiles/boxes/about_box.cpp +++ b/Telegram/SourceFiles/boxes/about_box.cpp @@ -7,7 +7,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "boxes/about_box.h" +#include "kotato/kotato_lang.h" #include "lang/lang_keys.h" +#include "lang/lang_instance.h" #include "mainwidget.h" #include "mainwindow.h" #include "ui/boxes/confirm_box.h" @@ -28,11 +30,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace { rpl::producer Text1() { - return tr::lng_about_text1( - lt_api_link, - tr::lng_about_text1_api( - ) | Ui::Text::ToLink("https://core.telegram.org/api"), - Ui::Text::WithEntities); + return rktre("ktg_about_text1", { + "tdesktop_link", + Ui::Text::Link(ktr("ktg_about_text1_tdesktop"), "https://desktop.telegram.org/") + }); } rpl::producer Text2() { @@ -40,19 +41,37 @@ rpl::producer Text2() { lt_gpl_link, rpl::single(Ui::Text::Link( "GNU GPL", - "https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE")), + "https://github.com/kotatogram/kotatogram-desktop/blob/master/LICENSE")), lt_github_link, rpl::single(Ui::Text::Link( "GitHub", - "https://github.com/telegramdesktop/tdesktop")), + "https://github.com/kotatogram/kotatogram-desktop")), Ui::Text::WithEntities); } rpl::producer Text3() { - return tr::lng_about_text3( - lt_faq_link, - tr::lng_about_text3_faq() | Ui::Text::ToLink(telegramFaqLink()), - Ui::Text::WithEntities); + auto baseLang = Lang::GetInstance().baseId(); + auto currentLang = Lang::Id(); + QString channelLink; + + for (const auto language : { "ru", "uk", "be" }) { + if (baseLang.startsWith(QLatin1String(language)) || currentLang == QString(language)) { + channelLink = "https://t.me/kotatogram_ru"; + break; + } + } + + if (channelLink.isEmpty()) { + channelLink = "https://t.me/kotatogram"; + } + + return rktre("ktg_about_text3", { + "channel_link", + Ui::Text::Link(ktr("ktg_about_text3_channel"), channelLink) + }, { + "faq_link", + Ui::Text::Link(tr::lng_about_text3_faq(tr::now), telegramFaqLink()) + }); } } // namespace @@ -65,7 +84,7 @@ AboutBox::AboutBox(QWidget *parent) } void AboutBox::prepare() { - setTitle(rpl::single(u"Telegram Desktop"_q)); + setTitle(rpl::single(u"Kotatogram Desktop"_q)); addButton(tr::lng_close(), [this] { closeBox(); }); diff --git a/Telegram/SourceFiles/boxes/connection_box.cpp b/Telegram/SourceFiles/boxes/connection_box.cpp index f50ef4b3a..a90dd702e 100644 --- a/Telegram/SourceFiles/boxes/connection_box.cpp +++ b/Telegram/SourceFiles/boxes/connection_box.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "boxes/connection_box.h" +#include "kotato/kotato_lang.h" #include "base/call_delayed.h" #include "base/qthelp_regex.h" #include "base/qthelp_url.h" @@ -1237,7 +1238,7 @@ void ProxiesBoxController::ShowApplyConfirmation( } else { Ui::show(Ui::MakeInformBox( (proxy.status() == ProxyData::Status::Unsupported - ? tr::lng_proxy_unsupported(tr::now) + ? ktr("ktg_proxy_unsupported") : tr::lng_proxy_invalid(tr::now)))); } } diff --git a/Telegram/SourceFiles/boxes/download_path_box.cpp b/Telegram/SourceFiles/boxes/download_path_box.cpp index f61c0e6e7..543b47092 100644 --- a/Telegram/SourceFiles/boxes/download_path_box.cpp +++ b/Telegram/SourceFiles/boxes/download_path_box.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "boxes/download_path_box.h" +#include "kotato/kotato_lang.h" #include "lang/lang_keys.h" #include "core/file_utilities.h" #include "ui/widgets/checkbox.h" @@ -30,7 +31,7 @@ DownloadPathBox::DownloadPathBox( this, _group, Directory::Downloads, - tr::lng_download_path_default_radio(tr::now), + ktr("ktg_download_path_default_radio"), st::defaultBoxCheckbox) : nullptr) , _temp(this, _group, Directory::Temp, tr::lng_download_path_temp_radio(tr::now), st::defaultBoxCheckbox) diff --git a/Telegram/SourceFiles/boxes/passcode_box.cpp b/Telegram/SourceFiles/boxes/passcode_box.cpp index 840e4872d..fb0c1a160 100644 --- a/Telegram/SourceFiles/boxes/passcode_box.cpp +++ b/Telegram/SourceFiles/boxes/passcode_box.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "boxes/passcode_box.h" +#include "kotato/kotato_lang.h" #include "base/bytes.h" #include "lang/lang_keys.h" #include "ui/boxes/confirm_box.h" @@ -273,7 +274,7 @@ void PasscodeBox::prepare() { ? *_cloudFields.customDescription : _cloudPwd ? tr::lng_cloud_password_about(tr::now) - : tr::lng_passcode_about(tr::now))); + : ktr("ktg_passcode_about"))); _aboutHeight = _about.countHeight(st::boxWidth - st::boxPadding.left() * 1.5); const auto onlyCheck = onlyCheckCurrent(); if (onlyCheck) { diff --git a/Telegram/SourceFiles/calls/calls_instance.cpp b/Telegram/SourceFiles/calls/calls_instance.cpp index 118532d16..91aa10ceb 100644 --- a/Telegram/SourceFiles/calls/calls_instance.cpp +++ b/Telegram/SourceFiles/calls/calls_instance.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "calls/calls_instance.h" +#include "kotato/kotato_lang.h" #include "calls/calls_call.h" #include "calls/group/calls_group_common.h" #include "calls/group/calls_choose_join_as.h" @@ -815,7 +816,7 @@ void Instance::requestPermissionOrFail(Platform::PermissionType type, Fn _currentGroupCall->hangup(); } Ui::show(Ui::MakeConfirmBox({ - .text = tr::lng_no_mic_permission(), + .text = ktr("ktg_no_mic_permission"), .confirmed = crl::guard(this, [=](Fn &&close) { Platform::OpenSystemSettingsForPermission(type); close(); diff --git a/Telegram/SourceFiles/data/data_cloud_themes.cpp b/Telegram/SourceFiles/data/data_cloud_themes.cpp index 5ac1c2052..28b55cbe3 100644 --- a/Telegram/SourceFiles/data/data_cloud_themes.cpp +++ b/Telegram/SourceFiles/data/data_cloud_themes.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "data/data_cloud_themes.h" +#include "kotato/kotato_lang.h" #include "window/themes/window_theme.h" #include "window/themes/window_theme_preview.h" #include "window/themes/window_theme_editor_box.h" @@ -222,7 +223,7 @@ void CloudThemes::resolve( showPreview(controller, result); }).fail([=](const MTP::Error &error) { if (error.type() == u"THEME_FORMAT_INVALID"_q) { - controller->show(Ui::MakeInformBox(tr::lng_theme_no_desktop())); + controller->show(Ui::MakeInformBox(ktr("ktg_theme_no_desktop"))); } }).send(); } @@ -246,7 +247,7 @@ void CloudThemes::showPreview( controller, cloud)); } else { - controller->show(Ui::MakeInformBox(tr::lng_theme_no_desktop())); + controller->show(Ui::MakeInformBox(ktr("ktg_theme_no_desktop"))); } } diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index a08c16119..5689b2066 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "dialogs/dialogs_widget.h" +#include "kotato/kotato_lang.h" #include "base/qt/qt_key_modifiers.h" #include "base/options.h" #include "dialogs/ui/dialogs_stories_content.h" @@ -1497,7 +1498,7 @@ void Widget::checkUpdateStatus() { } _updateTelegram.create( this, - tr::lng_update_telegram(tr::now), + ktr("ktg_update_telegram"), st::dialogsUpdateButton, st::dialogsInstallUpdate, st::dialogsInstallUpdateOver); diff --git a/Telegram/SourceFiles/export/view/export_view_progress.cpp b/Telegram/SourceFiles/export/view/export_view_progress.cpp index 5b946428b..4f889c2cc 100644 --- a/Telegram/SourceFiles/export/view/export_view_progress.cpp +++ b/Telegram/SourceFiles/export/view/export_view_progress.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "export/view/export_view_progress.h" +#include "kotato/kotato_lang.h" #include "ui/effects/animations.h" #include "ui/widgets/labels.h" #include "ui/widgets/buttons.h" @@ -263,7 +264,7 @@ ProgressWidget::ProgressWidget( _about = _body->add( object_ptr( this, - tr::lng_export_progress(tr::now), + ktr("ktg_export_progress"), st::exportAboutLabel), st::exportAboutPadding); diff --git a/Telegram/SourceFiles/history/history_item_helpers.cpp b/Telegram/SourceFiles/history/history_item_helpers.cpp index d3d9569e6..cacfa638c 100644 --- a/Telegram/SourceFiles/history/history_item_helpers.cpp +++ b/Telegram/SourceFiles/history/history_item_helpers.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/history_item_helpers.h" +#include "kotato/kotato_lang.h" #include "api/api_text_entities.h" #include "boxes/premium_preview_box.h" #include "calls/calls_instance.h" @@ -797,9 +798,9 @@ void CheckReactionNotificationSchedule( } [[nodiscard]] TextWithEntities UnsupportedMessageText() { - const auto siteLink = u"https://desktop.telegram.org"_q; + const auto siteLink = qsl("https://kotatogram.github.io"); auto result = TextWithEntities{ - tr::lng_message_unsupported(tr::now, lt_link, siteLink) + ktr("ktg_message_unsupported", { "link", siteLink }) }; TextUtilities::ParseEntities(result, Ui::ItemTextNoMonoOptions().flags); result.entities.push_front( diff --git a/Telegram/SourceFiles/intro/intro_code.cpp b/Telegram/SourceFiles/intro/intro_code.cpp index e5d09140c..ef80bde3c 100644 --- a/Telegram/SourceFiles/intro/intro_code.cpp +++ b/Telegram/SourceFiles/intro/intro_code.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "intro/intro_code.h" +#include "kotato/kotato_lang.h" #include "lang/lang_keys.h" #include "intro/intro_code_input.h" #include "intro/intro_signup.h" @@ -311,7 +312,7 @@ void CodeWidget::gotPassword(const MTPaccount_Password &result) { close(); }; Ui::show(Ui::MakeConfirmBox({ - .text = tr::lng_passport_app_out_of_date(), + .text = ktr("ktg_passport_app_out_of_date"), .confirmed = callback, .confirmText = tr::lng_menu_update(), })); diff --git a/Telegram/SourceFiles/intro/intro_start.cpp b/Telegram/SourceFiles/intro/intro_start.cpp index d4ebdec0b..fa2143efb 100644 --- a/Telegram/SourceFiles/intro/intro_start.cpp +++ b/Telegram/SourceFiles/intro/intro_start.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "intro/intro_start.h" +#include "kotato/kotato_lang.h" #include "lang/lang_keys.h" #include "intro/intro_qr.h" #include "intro/intro_phone.h" @@ -24,8 +25,8 @@ StartWidget::StartWidget( not_null data) : Step(parent, account, data, true) { setMouseTracking(true); - setTitleText(rpl::single(u"Telegram Desktop"_q)); - setDescriptionText(tr::lng_intro_about()); + setTitleText(rpl::single(u"Kotatogram Desktop"_q)); + setDescriptionText(rktr("ktg_intro_about")); show(); } diff --git a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp index c1d3c13fe..f491139ec 100644 --- a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp +++ b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp @@ -119,12 +119,9 @@ NotReadyBox::NotReadyBox( void NotReadyBox::prepare() { setTitle(tr::lng_language_not_ready_title()); - auto text = tr::lng_language_not_ready_about( - lt_lang_name, - rpl::single(_name) | Ui::Text::ToWithEntities(), - lt_link, - tr::lng_language_not_ready_link() | Ui::Text::ToLink(_editLink), - Ui::Text::WithEntities); + auto text = rktre("ktg_language_not_ready_about", + { "lang_name", { _name } }, + { "link", Ui::Text::Link(tr::lng_language_not_ready_link(tr::now), _editLink) }); const auto content = Ui::CreateChild>( this, object_ptr( diff --git a/Telegram/SourceFiles/passport/passport_panel_controller.cpp b/Telegram/SourceFiles/passport/passport_panel_controller.cpp index 14ee9bd78..64a24b64b 100644 --- a/Telegram/SourceFiles/passport/passport_panel_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_controller.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "passport/passport_panel_controller.h" +#include "kotato/kotato_lang.h" #include "main/main_account.h" #include "main/main_session.h" #include "lang/lang_keys.h" @@ -963,7 +964,7 @@ void PanelController::showUpdateAppBox() { }; show( Ui::MakeConfirmBox({ - .text = tr::lng_passport_app_out_of_date(), + .text = ktr("ktg_passport_app_out_of_date"), .confirmed = callback, .cancelled = [=] { _form->cancelSure(); }, .confirmText = tr::lng_menu_update(), diff --git a/Telegram/SourceFiles/platform/mac/main_window_mac.mm b/Telegram/SourceFiles/platform/mac/main_window_mac.mm index 8fc90a67f..5633c9513 100644 --- a/Telegram/SourceFiles/platform/mac/main_window_mac.mm +++ b/Telegram/SourceFiles/platform/mac/main_window_mac.mm @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "platform/mac/main_window_mac.h" +#include "kotato/kotato_lang.h" #include "data/data_session.h" #include "mainwidget.h" #include "core/application.h" @@ -543,7 +544,7 @@ void MainWindow::createGlobalMenu() { } window->addSeparator(); psShowTelegram = window->addAction( - tr::lng_mac_menu_show(tr::now), + ktr("ktg_mac_menu_show"), this, [=] { showFromTray(); }); diff --git a/Telegram/SourceFiles/platform/win/tray_win.cpp b/Telegram/SourceFiles/platform/win/tray_win.cpp index d2fa0af69..10d6849f5 100644 --- a/Telegram/SourceFiles/platform/win/tray_win.cpp +++ b/Telegram/SourceFiles/platform/win/tray_win.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "platform/win/tray_win.h" +#include "kotato/kotato_lang.h" #include "base/invoke_queued.h" #include "base/qt_signal_producer.h" #include "core/application.h" @@ -288,7 +289,7 @@ void Tray::showTrayMessage() const { if (!cSeenTrayTooltip() && _icon) { _icon->showMessage( AppName.utf16(), - tr::lng_tray_icon_text(tr::now), + ktr("ktg_tray_icon_text"), QIcon(), QPlatformSystemTrayIcon::Information, kTooltipDelay); diff --git a/Telegram/SourceFiles/settings/settings_advanced.cpp b/Telegram/SourceFiles/settings/settings_advanced.cpp index b833383f5..01326bf8c 100644 --- a/Telegram/SourceFiles/settings/settings_advanced.cpp +++ b/Telegram/SourceFiles/settings/settings_advanced.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "settings/settings_advanced.h" +#include "kotato/kotato_lang.h" #include "api/api_global_privacy.h" #include "apiwrap.h" #include "settings/settings_chat.h" @@ -145,7 +146,7 @@ void SetupUpdate(not_null container) { st::settingsButtonNoIcon)); const auto update = Ui::CreateChild