feat: sync translations

This commit is contained in:
ZavaruKitsu 2023-07-10 16:19:55 +00:00
parent f72e7178f5
commit 67df965f92
15 changed files with 90 additions and 57 deletions

View file

@ -3855,17 +3855,42 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_MarkReadAfterSend" = "Send read status after reply"; "ayu_MarkReadAfterSend" = "Send read status after reply";
"ayu_UseScheduledMessages" = "Schedule messages"; "ayu_UseScheduledMessages" = "Schedule messages";
"ayu_SpyEssentialsHeader" = "Spy essentials"; "ayu_SpyEssentialsHeader" = "Spy essentials";
"ayu_KeepDeletedMessages" = "Keep deleted messages"; "ayu_SaveDeletedMessages" = "Save deleted messages";
"ayu_KeepMessagesHistory" = "Keep edits history"; "ayu_SaveMessagesHistory" = "Save edits history";
"ayu_MessageSavingBtn" = "Message saving Preferences";
"ayu_MessageSavingMediaHeader" = "Media";
"ayu_MessageSavingSaveMedia" = "Save media";
"ayu_MessageSavingSaveMediaInPrivateChats" = "…in private chats";
"ayu_MessageSavingSaveMediaInPublicChannels" = "…in public channels";
"ayu_MessageSavingSaveMediaInPrivateChannels" = "…in private channels";
"ayu_MessageSavingSaveMediaInPublicGroups" = "…in public groups";
"ayu_MessageSavingSaveMediaInPrivateGroups" = "…in private groups";
"ayu_MessageSavingOtherHeader" = "Other";
"ayu_MessageSavingSaveFormatting" = "Save formatting";
"ayu_MessageSavingSaveReactions" = "Save reactions";
"ayu_QoLTogglesHeader" = "Useful features"; "ayu_QoLTogglesHeader" = "Useful features";
"ayu_ShowFromChannel" = "Show «channel» label"; "ayu_ShowFromChannel" = "Show «channel» label";
"ayu_KeepAliveService" = "Keep Alive Service"; "ayu_KeepAliveService" = "Keep Alive Service";
"ayu_EnableAds" = "Enable ads"; "ayu_EnableAds" = "Enable ads";
"ayu_LocalPremium" = "Local Telegram Premium";
"ayu_CustomizationHeader" = "Customization"; "ayu_CustomizationHeader" = "Customization";
"ayu_DeletedMarkText" = "Deleted mark"; "ayu_DeletedMarkText" = "Deleted mark";
"ayu_EditedMarkText" = "Edited mark"; "ayu_EditedMarkText" = "Edited mark";
"ayu_ShowGhostToggleInDrawer" = "Show ghost mode toggle"; "ayu_ShowGhostToggleInDrawer" = "Show ghost mode toggle";
"ayu_ShowKllButtonInDrawer" = "Show kill app button"; "ayu_ShowKllButtonInDrawer" = "Show kill app button";
"ayu_SettingsShowID" = "Show peer ID";
"ayu_SettingsShowID_Hide" = "Hide";
"ayu_SettingsRecentStickersCount" = "Recent stickers count";
"ayu_SettingsCustomizationHint" = "After making changes to the \"Customization\" section, you must restart the application.";
"ayu_RegexFilters" = "Message filters";
"ayu_RegexFiltersSubText" = "filters";
"ayu_RegexFiltersHeader" = "Filters";
"ayu_RegexFiltersEnableInChats" = "Enable in chats";
"ayu_RegexFiltersCaseInsensitive" = "Case insensitive expressions";
"ayu_RegexFiltersAdd" = "Add filter";
"ayu_RegexFiltersEdit" = "Edit filter";
"ayu_RegexFiltersAddDescription_Android" = "You can use site <![CDATA[<a href=\"https://regex101.com\">regex101.com</a>]]> to fully test your regular expression.\nYou can also use plain text, but don't forget to escape brackets.";
"ayu_RegexFiltersAddError" = "Regex syntax error";
"ayu_AyuSyncHeader" = "AyuSync"; "ayu_AyuSyncHeader" = "AyuSync";
"ayu_AyuSyncStatusTitle" = "Sync status"; "ayu_AyuSyncStatusTitle" = "Sync status";
"ayu_AyuSyncStatusOk" = "connected"; "ayu_AyuSyncStatusOk" = "connected";
@ -3885,27 +3910,34 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_AyuSyncLastEventNever" = "never"; "ayu_AyuSyncLastEventNever" = "never";
"ayu_AyuSyncUseSecureConnection" = "Use HTTPS & WSS"; "ayu_AyuSyncUseSecureConnection" = "Use HTTPS & WSS";
"ayu_AyuSyncIdentifierCopied" = "Identifier copied to clipboard."; "ayu_AyuSyncIdentifierCopied" = "Identifier copied to clipboard.";
"ayu_CleanDatabase" = "Clean database"; "ayu_AyuSyncRegisterStatusCode" = "Register status code";
"ayu_AyuSyncOpenPreferences" = "Open preferences";
"ayu_AyuSyncDownloadAgent" = "Download agent";
"ayu_WALMode" = "Enable WAL mode"; "ayu_WALMode" = "Enable WAL mode";
"ayu_CleanDatabase" = "Clean database";
"ayu_CleanDatabaseNotification" = "AyuGram database cleaned"; "ayu_CleanDatabaseNotification" = "AyuGram database cleaned";
"ayu_BetaFeatures" = "Beta features";
"ayu_StickerConfirmation" = "Confirmation when sending stickers";
"ayu_GIFConfirmation" = "Confirmation when sending GIFs";
"ayu_VoiceConfirmation" = "Confirmation when sending voice messages";
"ayu_EnableGhostMode" = "Enable Ghost"; "ayu_EnableGhostMode" = "Enable Ghost";
"ayu_DisableGhostMode" = "Disable Ghost"; "ayu_DisableGhostMode" = "Disable Ghost";
"ayu_KillApp" = "Kill App"; "ayu_KillApp" = "Kill App";
"ayu_DrawerGhostModeToggle" = "Ghost Mode";
"ayu_GhostModeEnabled" = "Ghost mode turned on"; "ayu_GhostModeEnabled" = "Ghost mode turned on";
"ayu_GhostModeDisabled" = "Ghost mode turned off"; "ayu_GhostModeDisabled" = "Ghost mode turned off";
"ayu_EditsHistoryTitle" = "Edits history"; "ayu_EditsHistoryTitle" = "Edits history";
"ayu_EditsHistoryMenuText" = "History"; "ayu_EditsHistoryMenuText" = "History";
"ayu_ReadUntilMenuText" = "Read until"; "ayu_ReadUntilMenuText" = "Read until";
"ayu_BoxActionReset" = "Reset";
"ayu_ReadConfirmationBoxQuestion" = "Do you want to read all messages?";
"ayu_ReadConfirmationBoxActionText" = "Read";
"ayu_ForwardsRestrictedInfoDeleted" = "Forwarding of a deleted message is not supported."; "ayu_ForwardsRestrictedInfoDeleted" = "Forwarding of a deleted message is not supported.";
"ayu_DeleteDateMenuText" = "Delete Date"; "ayu_DeleteDateMenuText" = "Delete Date";
"ayu_LikelyOfflineStatus" = "offline ?"; "ayu_LikelyOfflineStatus" = "offline ?";
"ayu_GhostModeShortcut" = "Enter with Ghost"; "ayu_GhostModeShortcut" = "Enter with Ghost";
"ayu_SettingsWatermark" = "AyuGram developed and maintained by Radolyn Labs."; "ayu_SettingsWatermark" = "AyuGram developed and maintained by Radolyn Labs.";
"ayu_SettingsCustomizationHint" = "After making changes to the \"Customization\" section, you must restart the application.";
"ayu_SettingsRecentStickersCount" = "Recent stickers count";
"ayu_SettingsShowID" = "Show peer ID";
"ayu_SettingsShowID_Hide" = "Hide";
"ayu_SettingsShowMessageSeconds" = "Show message seconds"; "ayu_SettingsShowMessageSeconds" = "Show message seconds";
"ayu_ContextCopyID" = "Copy ID"; "ayu_ContextCopyID" = "Copy ID";
"ayu_IDCopiedToast" = "ID copied to clipboard."; "ayu_IDCopiedToast" = "ID copied to clipboard.";
"ayu_DrawerGhostModeToggle" = "Ghost Mode"; "ayu_ContextHideMessage" = "Hide";

View file

@ -108,7 +108,14 @@ namespace AyuSettings
initialize(); initialize();
json p = json::parse(data); json p = json::parse(data);
settings = p.get<AyuGramSettings>(); try
{
settings = p.get<AyuGramSettings>();
}
catch (...)
{
LOG(("AyuGramSettings: failed to parse settings file"));
}
postinitialize(); postinitialize();
} }
@ -162,12 +169,12 @@ namespace AyuSettings
void AyuGramSettings::set_keepDeletedMessages(bool val) void AyuGramSettings::set_keepDeletedMessages(bool val)
{ {
keepDeletedMessages = val; saveDeletedMessages = val;
} }
void AyuGramSettings::set_keepMessagesHistory(bool val) void AyuGramSettings::set_keepMessagesHistory(bool val)
{ {
keepMessagesHistory = val; saveMessagesHistory = val;
} }
void AyuGramSettings::set_enableAds(bool val) void AyuGramSettings::set_enableAds(bool val)

View file

@ -30,8 +30,8 @@ namespace AyuSettings
useScheduledMessages = false; useScheduledMessages = false;
// ~ Message edits & deletion history // ~ Message edits & deletion history
keepDeletedMessages = true; saveDeletedMessages = true;
keepMessagesHistory = true; saveMessagesHistory = true;
// ~ QoL toggles // ~ QoL toggles
enableAds = false; enableAds = false;
@ -42,11 +42,6 @@ namespace AyuSettings
recentStickersCount = 20; recentStickersCount = 20;
showGhostToggleInDrawer = true; showGhostToggleInDrawer = true;
// ~ Beta functionality
stickerConfirmation = false;
GIFConfirmation = false;
voiceConfirmation = false;
/* /*
* showPeerId = 0 means no ID shown * showPeerId = 0 means no ID shown
* showPeerId = 1 means ID shown as for Telegram API devs * showPeerId = 1 means ID shown as for Telegram API devs
@ -55,6 +50,8 @@ namespace AyuSettings
showPeerId = 2; showPeerId = 2;
showMessageSeconds = false; showMessageSeconds = false;
// ~ Beta functionality
stickerConfirmation = false; stickerConfirmation = false;
GIFConfirmation = false; GIFConfirmation = false;
voiceConfirmation = false; voiceConfirmation = false;
@ -66,8 +63,8 @@ namespace AyuSettings
bool sendOfflinePacketAfterOnline; bool sendOfflinePacketAfterOnline;
bool markReadAfterSend; bool markReadAfterSend;
bool useScheduledMessages; bool useScheduledMessages;
bool keepDeletedMessages; bool saveDeletedMessages;
bool keepMessagesHistory; bool saveMessagesHistory;
bool enableAds; bool enableAds;
QString deletedMark; QString deletedMark;
QString editedMark; QString editedMark;
@ -125,8 +122,8 @@ namespace AyuSettings
sendOfflinePacketAfterOnline, sendOfflinePacketAfterOnline,
markReadAfterSend, markReadAfterSend,
useScheduledMessages, useScheduledMessages,
keepDeletedMessages, saveDeletedMessages,
keepMessagesHistory, saveMessagesHistory,
enableAds, enableAds,
deletedMark, deletedMark,
editedMark, editedMark,

View file

@ -26,11 +26,7 @@ namespace AyuUi
void ConfirmationBox::prepare() void ConfirmationBox::prepare()
{ {
// setTitle(rpl::single(QString("Confirmation for SRead"))); _text.create(this, tr::ayu_ReadConfirmationBoxQuestion(), st::boxLabel);
auto details = TextWithEntities();
details.text = QString("Do you want to read all messages?");
_text.create(this, rpl::single(std::move(details)), st::boxLabel);
auto fullHeight = st::boxPadding.top() auto fullHeight = st::boxPadding.top()
+ _text->height() + _text->height()
@ -38,7 +34,7 @@ namespace AyuUi
setDimensions(st::boxWidth, fullHeight); setDimensions(st::boxWidth, fullHeight);
addButton(rpl::single(QString("Read")), [=, this] addButton(tr::ayu_ReadConfirmationBoxActionText(), [=, this]
{ {
ReadAllPeers(); ReadAllPeers();
closeBox(); closeBox();

View file

@ -32,7 +32,7 @@ EditDeletedMarkBox::EditDeletedMarkBox(QWidget*) :
_text( _text(
this, this,
st::defaultInputField, st::defaultInputField,
rpl::single(QString("Deleted Mark")), tr::ayu_DeletedMarkText(),
AyuSettings::getInstance().deletedMark) AyuSettings::getInstance().deletedMark)
{ {
} }
@ -42,12 +42,12 @@ void EditDeletedMarkBox::prepare()
const auto defaultDeletedMark = "🧹"; const auto defaultDeletedMark = "🧹";
auto newHeight = st::contactPadding.top() + _text->height(); auto newHeight = st::contactPadding.top() + _text->height();
setTitle(rpl::single(QString("Edit Deleted Mark"))); setTitle(tr::ayu_DeletedMarkText());
newHeight += st::boxPadding.bottom() + st::contactPadding.bottom(); newHeight += st::boxPadding.bottom() + st::contactPadding.bottom();
setDimensions(st::boxWidth, newHeight); setDimensions(st::boxWidth, newHeight);
addLeftButton(rpl::single(QString("Reset")), [=] { _text->setText(defaultDeletedMark); }); addLeftButton(tr::ayu_BoxActionReset(), [=] { _text->setText(defaultDeletedMark); });
addButton(tr::lng_settings_save(), [=] { save(); }); addButton(tr::lng_settings_save(), [=] { save(); });
addButton(tr::lng_cancel(), [=] { closeBox(); }); addButton(tr::lng_cancel(), [=] { closeBox(); });

View file

@ -32,7 +32,7 @@ EditEditedMarkBox::EditEditedMarkBox(QWidget*) :
_text( _text(
this, this,
st::defaultInputField, st::defaultInputField,
rpl::single(QString("Edited mark")), tr::ayu_EditedMarkText(),
AyuSettings::getInstance().editedMark) AyuSettings::getInstance().editedMark)
{ {
} }
@ -43,12 +43,12 @@ void EditEditedMarkBox::prepare()
const auto defaultEditedMark = tr::lng_edited(tr::now); const auto defaultEditedMark = tr::lng_edited(tr::now);
auto newHeight = st::contactPadding.top() + _text->height(); auto newHeight = st::contactPadding.top() + _text->height();
setTitle(rpl::single(QString("Edit edited Mark"))); setTitle(tr::ayu_EditedMarkText());
newHeight += st::boxPadding.bottom() + st::contactPadding.bottom(); newHeight += st::boxPadding.bottom() + st::contactPadding.bottom();
setDimensions(st::boxWidth, newHeight); setDimensions(st::boxWidth, newHeight);
addLeftButton(rpl::single(QString("Reset")), [=] { _text->setText(defaultEditedMark); }); addLeftButton(tr::ayu_BoxActionReset(), [=] { _text->setText(defaultEditedMark); });
addButton(tr::lng_settings_save(), [=] { save(); }); addButton(tr::lng_settings_save(), [=] { save(); });
addButton(tr::lng_cancel(), [=] { closeBox(); }); addButton(tr::lng_cancel(), [=] { closeBox(); });

View file

@ -4,6 +4,7 @@
// but be respectful and credit the original author. // but be respectful and credit the original author.
// //
// Copyright @Radolyn, 2023 // Copyright @Radolyn, 2023
#include "ui/boxes/confirm_box.h" #include "ui/boxes/confirm_box.h"
#include "voice_confirmation_box.h" #include "voice_confirmation_box.h"

View file

@ -4,6 +4,7 @@
// but be respectful and credit the original author. // but be respectful and credit the original author.
// //
// Copyright @Radolyn, 2023 // Copyright @Radolyn, 2023
#pragma once #pragma once
#include "ui/boxes/confirm_box.h" #include "ui/boxes/confirm_box.h"

View file

@ -39,9 +39,9 @@ namespace AyuUi
{ {
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
const auto history = item->history(); const auto history = item->history();
_ayuSubMenu->addAction(QString("Hide"), [=]() _ayuSubMenu->addAction(tr::ayu_ContextHideMessage(tr::now), [=]()
{ {
const auto initKeepDeleted = settings->keepDeletedMessages; const auto initKeepDeleted = settings->saveDeletedMessages;
settings->set_keepDeletedMessages(false); settings->set_keepDeletedMessages(false);
history->destroyMessage(item); history->destroyMessage(item);

View file

@ -55,7 +55,6 @@ namespace AyuUi
{ {
setTitle(tr::ayu_EditsHistoryTitle()); setTitle(tr::ayu_EditsHistoryTitle());
// setDimensionsToContent(st::boxWideWidth, _content);
setDimensions(st::boxWideWidth, 900); setDimensions(st::boxWideWidth, 900);
SetupShadowsToScrollContent(this, _scroll, _contentHeight.events()); SetupShadowsToScrollContent(this, _scroll, _contentHeight.events());
} }

View file

@ -157,14 +157,14 @@ namespace Settings
AddButton( AddButton(
container, container,
tr::ayu_KeepDeletedMessages(), tr::ayu_SaveDeletedMessages(),
st::settingsButtonNoIcon st::settingsButtonNoIcon
)->toggleOn( )->toggleOn(
rpl::single(settings->keepDeletedMessages) rpl::single(settings->saveDeletedMessages)
)->toggledValue( )->toggledValue(
) | rpl::filter([=](bool enabled) ) | rpl::filter([=](bool enabled)
{ {
return (enabled != settings->keepDeletedMessages); return (enabled != settings->saveDeletedMessages);
}) | start_with_next([=](bool enabled) }) | start_with_next([=](bool enabled)
{ {
settings->set_keepDeletedMessages(enabled); settings->set_keepDeletedMessages(enabled);
@ -173,14 +173,14 @@ namespace Settings
AddButton( AddButton(
container, container,
tr::ayu_KeepMessagesHistory(), tr::ayu_SaveMessagesHistory(),
st::settingsButtonNoIcon st::settingsButtonNoIcon
)->toggleOn( )->toggleOn(
rpl::single(settings->keepMessagesHistory) rpl::single(settings->saveMessagesHistory)
)->toggledValue( )->toggledValue(
) | rpl::filter([=](bool enabled) ) | rpl::filter([=](bool enabled)
{ {
return (enabled != settings->keepMessagesHistory); return (enabled != settings->saveMessagesHistory);
}) | start_with_next([=](bool enabled) }) | start_with_next([=](bool enabled)
{ {
settings->set_keepMessagesHistory(enabled); settings->set_keepMessagesHistory(enabled);
@ -366,13 +366,13 @@ namespace Settings
void Ayu::SetupAyuSync(not_null<Ui::VerticalLayout*> container) void Ayu::SetupAyuSync(not_null<Ui::VerticalLayout*> container)
{ {
AddSubsectionTitle(container, rpl::single(QString("AyuSync"))); AddSubsectionTitle(container, tr::ayu_AyuSyncHeader());
auto text = AyuSync::isAgentDownloaded() ? QString("Open preferences") : QString("Download agent"); auto text = AyuSync::isAgentDownloaded() ? tr::ayu_AyuSyncOpenPreferences() : tr::ayu_AyuSyncDownloadAgent();
AddButton( AddButton(
container, container,
rpl::single(text), text,
st::settingsButtonNoIcon st::settingsButtonNoIcon
)->addClickHandler([=] )->addClickHandler([=]
{ {
@ -385,11 +385,11 @@ namespace Settings
{ {
auto settings = &AyuSettings::getInstance(); auto settings = &AyuSettings::getInstance();
AddSubsectionTitle(container, rpl::single(QString("Beta functions"))); AddSubsectionTitle(container, tr::ayu_BetaFeatures());
AddButton( AddButton(
container, container,
rpl::single(QString("Send sticker confirmation")), tr::ayu_StickerConfirmation(),
st::settingsButtonNoIcon st::settingsButtonNoIcon
)->toggleOn( )->toggleOn(
rpl::single(settings->stickerConfirmation) rpl::single(settings->stickerConfirmation)
@ -405,7 +405,7 @@ namespace Settings
AddButton( AddButton(
container, container,
rpl::single(QString("Send GIF confirmation")), tr::ayu_GIFConfirmation(),
st::settingsButtonNoIcon st::settingsButtonNoIcon
)->toggleOn( )->toggleOn(
rpl::single(settings->GIFConfirmation) rpl::single(settings->GIFConfirmation)
@ -421,7 +421,7 @@ namespace Settings
AddButton( AddButton(
container, container,
rpl::single(QString("Send voice confirmation")), tr::ayu_VoiceConfirmation(),
st::settingsButtonNoIcon st::settingsButtonNoIcon
)->toggleOn( )->toggleOn(
rpl::single(settings->voiceConfirmation) rpl::single(settings->voiceConfirmation)

View file

@ -2164,7 +2164,7 @@ void Session::updateEditedMessage(const MTPMessage &data) {
return; return;
} }
// AyuGram keepMessagesHistory // AyuGram saveMessagesHistory
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
HistoryMessageEdition edit; HistoryMessageEdition edit;
@ -2173,7 +2173,7 @@ void Session::updateEditedMessage(const MTPMessage &data) {
goto proceed; goto proceed;
} }
edit = HistoryMessageEdition(_session, data.c_message()); edit = HistoryMessageEdition(_session, data.c_message());
if (settings->keepMessagesHistory && !existing->isLocal() && !existing->author()->isSelf() && !edit.isEditHide) if (settings->saveMessagesHistory && !existing->isLocal() && !existing->author()->isSelf() && !edit.isEditHide)
{ {
const auto history = existing->history(); const auto history = existing->history();
const auto msg = existing->originalText(); const auto msg = existing->originalText();

View file

@ -479,9 +479,9 @@ not_null<HistoryItem*> History::insertItem(
void History::destroyMessage(not_null<HistoryItem*> item) { void History::destroyMessage(not_null<HistoryItem*> item) {
Expects(item->isHistoryEntry() || !item->mainView()); Expects(item->isHistoryEntry() || !item->mainView());
// AyuGram keepDeletedMessages // AyuGram saveDeletedMessages
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
if (settings->keepDeletedMessages && item->isRegular() && !item->isGroupMigrate()) if (settings->saveDeletedMessages && item->isRegular() && !item->isGroupMigrate())
{ {
if (!item->isService()) if (!item->isService())
{ {

View file

@ -2389,7 +2389,7 @@ void HistoryItem::setForwardsCount(int count) {
void HistoryItem::setPostAuthor(const QString &author) { void HistoryItem::setPostAuthor(const QString &author) {
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
if (settings->keepDeletedMessages && !(_flags & MessageFlag::HasPostAuthor)) if (settings->saveDeletedMessages && !(_flags & MessageFlag::HasPostAuthor))
{ {
_flags |= MessageFlag::HasPostAuthor; _flags |= MessageFlag::HasPostAuthor;
} }
@ -2413,7 +2413,7 @@ void HistoryItem::setPostAuthor(const QString &author) {
msgsigned->isAnonymousRank = !isDiscussionPost() msgsigned->isAnonymousRank = !isDiscussionPost()
&& this->author()->isMegagroup(); && this->author()->isMegagroup();
if (settings->keepDeletedMessages) if (settings->saveDeletedMessages)
{ {
history()->owner().requestItemViewRefresh(this); history()->owner().requestItemViewRefresh(this);
} }

View file

@ -1094,7 +1094,7 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
const auto history = item->history(); const auto history = item->history();
result->addAction(QString("Hide"), [=]() result->addAction(QString("Hide"), [=]()
{ {
const auto initKeepDeleted = settings->keepDeletedMessages; const auto initKeepDeleted = settings->saveDeletedMessages;
settings->set_keepDeletedMessages(false); settings->set_keepDeletedMessages(false);
history->destroyMessage(item); history->destroyMessage(item);