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_UseScheduledMessages" = "Schedule messages";
"ayu_SpyEssentialsHeader" = "Spy essentials";
"ayu_KeepDeletedMessages" = "Keep deleted messages";
"ayu_KeepMessagesHistory" = "Keep edits history";
"ayu_SaveDeletedMessages" = "Save deleted messages";
"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_ShowFromChannel" = "Show «channel» label";
"ayu_KeepAliveService" = "Keep Alive Service";
"ayu_EnableAds" = "Enable ads";
"ayu_LocalPremium" = "Local Telegram Premium";
"ayu_CustomizationHeader" = "Customization";
"ayu_DeletedMarkText" = "Deleted mark";
"ayu_EditedMarkText" = "Edited mark";
"ayu_ShowGhostToggleInDrawer" = "Show ghost mode toggle";
"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_AyuSyncStatusTitle" = "Sync status";
"ayu_AyuSyncStatusOk" = "connected";
@ -3885,27 +3910,34 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_AyuSyncLastEventNever" = "never";
"ayu_AyuSyncUseSecureConnection" = "Use HTTPS & WSS";
"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_CleanDatabase" = "Clean database";
"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_DisableGhostMode" = "Disable Ghost";
"ayu_KillApp" = "Kill App";
"ayu_DrawerGhostModeToggle" = "Ghost Mode";
"ayu_GhostModeEnabled" = "Ghost mode turned on";
"ayu_GhostModeDisabled" = "Ghost mode turned off";
"ayu_EditsHistoryTitle" = "Edits history";
"ayu_EditsHistoryMenuText" = "History";
"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_DeleteDateMenuText" = "Delete Date";
"ayu_LikelyOfflineStatus" = "offline ?";
"ayu_GhostModeShortcut" = "Enter with Ghost";
"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_ContextCopyID" = "Copy ID";
"ayu_IDCopiedToast" = "ID copied to clipboard.";
"ayu_DrawerGhostModeToggle" = "Ghost Mode";
"ayu_ContextHideMessage" = "Hide";

View file

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

View file

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

View file

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

View file

@ -32,7 +32,7 @@ EditDeletedMarkBox::EditDeletedMarkBox(QWidget*) :
_text(
this,
st::defaultInputField,
rpl::single(QString("Deleted Mark")),
tr::ayu_DeletedMarkText(),
AyuSettings::getInstance().deletedMark)
{
}
@ -42,12 +42,12 @@ void EditDeletedMarkBox::prepare()
const auto defaultDeletedMark = "🧹";
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();
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_cancel(), [=] { closeBox(); });

View file

@ -32,7 +32,7 @@ EditEditedMarkBox::EditEditedMarkBox(QWidget*) :
_text(
this,
st::defaultInputField,
rpl::single(QString("Edited mark")),
tr::ayu_EditedMarkText(),
AyuSettings::getInstance().editedMark)
{
}
@ -43,12 +43,12 @@ void EditEditedMarkBox::prepare()
const auto defaultEditedMark = tr::lng_edited(tr::now);
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();
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_cancel(), [=] { closeBox(); });

View file

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

View file

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

View file

@ -39,9 +39,9 @@ namespace AyuUi
{
const auto settings = &AyuSettings::getInstance();
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);
history->destroyMessage(item);

View file

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

View file

@ -157,14 +157,14 @@ namespace Settings
AddButton(
container,
tr::ayu_KeepDeletedMessages(),
tr::ayu_SaveDeletedMessages(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings->keepDeletedMessages)
rpl::single(settings->saveDeletedMessages)
)->toggledValue(
) | rpl::filter([=](bool enabled)
{
return (enabled != settings->keepDeletedMessages);
return (enabled != settings->saveDeletedMessages);
}) | start_with_next([=](bool enabled)
{
settings->set_keepDeletedMessages(enabled);
@ -173,14 +173,14 @@ namespace Settings
AddButton(
container,
tr::ayu_KeepMessagesHistory(),
tr::ayu_SaveMessagesHistory(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings->keepMessagesHistory)
rpl::single(settings->saveMessagesHistory)
)->toggledValue(
) | rpl::filter([=](bool enabled)
{
return (enabled != settings->keepMessagesHistory);
return (enabled != settings->saveMessagesHistory);
}) | start_with_next([=](bool enabled)
{
settings->set_keepMessagesHistory(enabled);
@ -366,13 +366,13 @@ namespace Settings
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(
container,
rpl::single(text),
text,
st::settingsButtonNoIcon
)->addClickHandler([=]
{
@ -385,11 +385,11 @@ namespace Settings
{
auto settings = &AyuSettings::getInstance();
AddSubsectionTitle(container, rpl::single(QString("Beta functions")));
AddSubsectionTitle(container, tr::ayu_BetaFeatures());
AddButton(
container,
rpl::single(QString("Send sticker confirmation")),
tr::ayu_StickerConfirmation(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings->stickerConfirmation)
@ -405,7 +405,7 @@ namespace Settings
AddButton(
container,
rpl::single(QString("Send GIF confirmation")),
tr::ayu_GIFConfirmation(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings->GIFConfirmation)
@ -421,7 +421,7 @@ namespace Settings
AddButton(
container,
rpl::single(QString("Send voice confirmation")),
tr::ayu_VoiceConfirmation(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings->voiceConfirmation)

View file

@ -2164,7 +2164,7 @@ void Session::updateEditedMessage(const MTPMessage &data) {
return;
}
// AyuGram keepMessagesHistory
// AyuGram saveMessagesHistory
const auto settings = &AyuSettings::getInstance();
HistoryMessageEdition edit;
@ -2173,7 +2173,7 @@ void Session::updateEditedMessage(const MTPMessage &data) {
goto proceed;
}
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 msg = existing->originalText();

View file

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

View file

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

View file

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