From 2464610b05614ad720e4091bce1f0bccd7b8fefa Mon Sep 17 00:00:00 2001 From: primetime43 <12754111+primetime43@users.noreply.github.com> Date: Mon, 18 May 2026 20:19:32 -0400 Subject: [PATCH] Add delete dialog localization and bindings Introduce localized strings for the Delete setup (warning title/subtext, date/time tooltips and DELETE button) across English, French, German, Spanish and Ukrainian resource files. Expose new Delete* properties on LocalizationManager. Update DeleteSetupViewModel to accept and expose a LocalizationManager instance for data-binding. Replace hard-coded texts in DeleteSetupView.axaml with bindings to LocalizationManager (warning text, tooltips, labels and buttons) so the delete dialog uses localized content. --- .../LocalizationManager.English.cs | 10 +++++++ .../LocalizationManager.French.cs | 14 ++++++++++ .../LocalizationManager.German.cs | 14 ++++++++++ .../LocalizationManager.Spanish.cs | 14 ++++++++++ .../LocalizationManager.Ukrainian.cs | 13 ++++++++++ .../Localization/LocalizationManager.cs | 10 +++++++ .../Dialogs/DeleteSetupViewModel.cs | 6 ++++- .../Views/Dialogs/DeleteSetupView.axaml | 26 +++++++++---------- 8 files changed, 93 insertions(+), 14 deletions(-) diff --git a/DiscordChatExporter.Gui/Localization/LocalizationManager.English.cs b/DiscordChatExporter.Gui/Localization/LocalizationManager.English.cs index eb9cfd3f..46a4e8d6 100644 --- a/DiscordChatExporter.Gui/Localization/LocalizationManager.English.cs +++ b/DiscordChatExporter.Gui/Localization/LocalizationManager.English.cs @@ -125,6 +125,16 @@ public partial class LocalizationManager "Download assets to this directory. If not specified, the asset directory path will be derived from the output path.", [nameof(AdvancedOptionsTooltip)] = "Toggle advanced options", [nameof(ExportButton)] = "EXPORT", + // Delete Setup + [nameof(DeleteWarningTitle)] = + "⚠ WARNING: This will permanently delete messages from the channel.", + [nameof(DeleteWarningSubtext)] = + "You can only delete your own messages. Messages from other users will be skipped.", + [nameof(DeleteAfterDateTooltip)] = "Only delete messages sent after this date", + [nameof(DeleteBeforeDateTooltip)] = "Only delete messages sent before this date", + [nameof(DeleteAfterTimeTooltip)] = "Only delete messages sent after this time", + [nameof(DeleteBeforeTimeTooltip)] = "Only delete messages sent before this time", + [nameof(DeleteButton)] = "DELETE", // Common buttons [nameof(CloseButton)] = "CLOSE", [nameof(CancelButton)] = "CANCEL", diff --git a/DiscordChatExporter.Gui/Localization/LocalizationManager.French.cs b/DiscordChatExporter.Gui/Localization/LocalizationManager.French.cs index afbdb7d5..f46d058e 100644 --- a/DiscordChatExporter.Gui/Localization/LocalizationManager.French.cs +++ b/DiscordChatExporter.Gui/Localization/LocalizationManager.French.cs @@ -127,6 +127,20 @@ public partial class LocalizationManager "Télécharger les ressources dans ce dossier. Si non spécifié, le chemin sera dérivé du chemin de sortie.", [nameof(AdvancedOptionsTooltip)] = "Basculer les options avancées", [nameof(ExportButton)] = "EXPORTER", + // Delete Setup + [nameof(DeleteWarningTitle)] = + "⚠ AVERTISSEMENT : Cette action supprimera définitivement les messages du canal.", + [nameof(DeleteWarningSubtext)] = + "Vous ne pouvez supprimer que vos propres messages. Les messages des autres utilisateurs seront ignorés.", + [nameof(DeleteAfterDateTooltip)] = + "Supprimer uniquement les messages envoyés après cette date", + [nameof(DeleteBeforeDateTooltip)] = + "Supprimer uniquement les messages envoyés avant cette date", + [nameof(DeleteAfterTimeTooltip)] = + "Supprimer uniquement les messages envoyés après cette heure", + [nameof(DeleteBeforeTimeTooltip)] = + "Supprimer uniquement les messages envoyés avant cette heure", + [nameof(DeleteButton)] = "SUPPRIMER", // Common buttons [nameof(CloseButton)] = "FERMER", [nameof(CancelButton)] = "ANNULER", diff --git a/DiscordChatExporter.Gui/Localization/LocalizationManager.German.cs b/DiscordChatExporter.Gui/Localization/LocalizationManager.German.cs index d28677b6..89c36085 100644 --- a/DiscordChatExporter.Gui/Localization/LocalizationManager.German.cs +++ b/DiscordChatExporter.Gui/Localization/LocalizationManager.German.cs @@ -131,6 +131,20 @@ public partial class LocalizationManager "Assets in dieses Verzeichnis herunterladen. Wenn nicht angegeben, wird der Asset-Verzeichnispfad vom Ausgabepfad abgeleitet.", [nameof(AdvancedOptionsTooltip)] = "Erweiterte Optionen umschalten", [nameof(ExportButton)] = "EXPORTIEREN", + // Delete Setup + [nameof(DeleteWarningTitle)] = + "⚠ WARNUNG: Dadurch werden Nachrichten dauerhaft aus dem Kanal gelöscht.", + [nameof(DeleteWarningSubtext)] = + "Sie können nur Ihre eigenen Nachrichten löschen. Nachrichten anderer Benutzer werden übersprungen.", + [nameof(DeleteAfterDateTooltip)] = + "Nur Nachrichten löschen, die nach diesem Datum gesendet wurden", + [nameof(DeleteBeforeDateTooltip)] = + "Nur Nachrichten löschen, die vor diesem Datum gesendet wurden", + [nameof(DeleteAfterTimeTooltip)] = + "Nur Nachrichten löschen, die nach dieser Uhrzeit gesendet wurden", + [nameof(DeleteBeforeTimeTooltip)] = + "Nur Nachrichten löschen, die vor dieser Uhrzeit gesendet wurden", + [nameof(DeleteButton)] = "LÖSCHEN", // Common buttons [nameof(CloseButton)] = "SCHLIESSEN", [nameof(CancelButton)] = "ABBRECHEN", diff --git a/DiscordChatExporter.Gui/Localization/LocalizationManager.Spanish.cs b/DiscordChatExporter.Gui/Localization/LocalizationManager.Spanish.cs index ccb1ca6b..e151e5de 100644 --- a/DiscordChatExporter.Gui/Localization/LocalizationManager.Spanish.cs +++ b/DiscordChatExporter.Gui/Localization/LocalizationManager.Spanish.cs @@ -125,6 +125,20 @@ public partial class LocalizationManager "Descargar recursos en este directorio. Si no se especifica, la ruta se derivará de la ruta de salida.", [nameof(AdvancedOptionsTooltip)] = "Alternar opciones avanzadas", [nameof(ExportButton)] = "EXPORTAR", + // Delete Setup + [nameof(DeleteWarningTitle)] = + "⚠ ADVERTENCIA: Esto eliminará permanentemente los mensajes del canal.", + [nameof(DeleteWarningSubtext)] = + "Solo puedes eliminar tus propios mensajes. Se omitirán los mensajes de otros usuarios.", + [nameof(DeleteAfterDateTooltip)] = + "Eliminar solo los mensajes enviados después de esta fecha", + [nameof(DeleteBeforeDateTooltip)] = + "Eliminar solo los mensajes enviados antes de esta fecha", + [nameof(DeleteAfterTimeTooltip)] = + "Eliminar solo los mensajes enviados después de esta hora", + [nameof(DeleteBeforeTimeTooltip)] = + "Eliminar solo los mensajes enviados antes de esta hora", + [nameof(DeleteButton)] = "ELIMINAR", // Common buttons [nameof(CloseButton)] = "CERRAR", [nameof(CancelButton)] = "CANCELAR", diff --git a/DiscordChatExporter.Gui/Localization/LocalizationManager.Ukrainian.cs b/DiscordChatExporter.Gui/Localization/LocalizationManager.Ukrainian.cs index 925ea18c..ce1c0515 100644 --- a/DiscordChatExporter.Gui/Localization/LocalizationManager.Ukrainian.cs +++ b/DiscordChatExporter.Gui/Localization/LocalizationManager.Ukrainian.cs @@ -125,6 +125,19 @@ public partial class LocalizationManager "Завантажувати ресурси до цієї директорії. Якщо не вказано, шлях до директорії ресурсів буде визначено з шляху збереження.", [nameof(AdvancedOptionsTooltip)] = "Перемкнути розширені параметри", [nameof(ExportButton)] = "ЕКСПОРТУВАТИ", + // Delete Setup + [nameof(DeleteWarningTitle)] = "⚠ УВАГА: Це назавжди видалить повідомлення з каналу.", + [nameof(DeleteWarningSubtext)] = + "Ви можете видаляти лише власні повідомлення. Повідомлення інших користувачів буде пропущено.", + [nameof(DeleteAfterDateTooltip)] = + "Видаляти лише повідомлення, надіслані після цієї дати", + [nameof(DeleteBeforeDateTooltip)] = + "Видаляти лише повідомлення, надіслані до цієї дати", + [nameof(DeleteAfterTimeTooltip)] = + "Видаляти лише повідомлення, надіслані після цього часу", + [nameof(DeleteBeforeTimeTooltip)] = + "Видаляти лише повідомлення, надіслані до цього часу", + [nameof(DeleteButton)] = "ВИДАЛИТИ", // Common buttons [nameof(CloseButton)] = "ЗАКРИТИ", [nameof(CancelButton)] = "СКАСУВАТИ", diff --git a/DiscordChatExporter.Gui/Localization/LocalizationManager.cs b/DiscordChatExporter.Gui/Localization/LocalizationManager.cs index db670ce0..fc97fa4b 100644 --- a/DiscordChatExporter.Gui/Localization/LocalizationManager.cs +++ b/DiscordChatExporter.Gui/Localization/LocalizationManager.cs @@ -143,6 +143,16 @@ public partial class LocalizationManager public string AdvancedOptionsTooltip => Get(); public string ExportButton => Get(); + // ---- Delete Setup ---- + + public string DeleteWarningTitle => Get(); + public string DeleteWarningSubtext => Get(); + public string DeleteAfterDateTooltip => Get(); + public string DeleteBeforeDateTooltip => Get(); + public string DeleteAfterTimeTooltip => Get(); + public string DeleteBeforeTimeTooltip => Get(); + public string DeleteButton => Get(); + // ---- Common buttons ---- public string CloseButton => Get(); diff --git a/DiscordChatExporter.Gui/ViewModels/Dialogs/DeleteSetupViewModel.cs b/DiscordChatExporter.Gui/ViewModels/Dialogs/DeleteSetupViewModel.cs index 9ed75f18..006a0461 100644 --- a/DiscordChatExporter.Gui/ViewModels/Dialogs/DeleteSetupViewModel.cs +++ b/DiscordChatExporter.Gui/ViewModels/Dialogs/DeleteSetupViewModel.cs @@ -5,11 +5,15 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using DiscordChatExporter.Core.Discord.Data; using DiscordChatExporter.Gui.Framework; +using DiscordChatExporter.Gui.Localization; namespace DiscordChatExporter.Gui.ViewModels.Dialogs; -public partial class DeleteSetupViewModel : DialogViewModelBase +public partial class DeleteSetupViewModel(LocalizationManager localizationManager) + : DialogViewModelBase { + public LocalizationManager LocalizationManager { get; } = localizationManager; + [ObservableProperty] public partial Guild? Guild { get; set; } diff --git a/DiscordChatExporter.Gui/Views/Dialogs/DeleteSetupView.axaml b/DiscordChatExporter.Gui/Views/Dialogs/DeleteSetupView.axaml index 33b4327e..254d6e34 100644 --- a/DiscordChatExporter.Gui/Views/Dialogs/DeleteSetupView.axaml +++ b/DiscordChatExporter.Gui/Views/Dialogs/DeleteSetupView.axaml @@ -37,7 +37,7 @@ IsVisible="{Binding !IsSingleChannel}" TextTrimming="CharacterEllipsis"> - + @@ -78,9 +78,9 @@ FontWeight="SemiBold" Foreground="#FFFFA500" TextWrapping="Wrap"> - + - + @@ -90,9 +90,9 @@ Grid.Row="0" Grid.Column="0" Margin="16,8,8,8" - materialAssists:TextFieldAssist.Label="After (date)" + materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.AfterDateLabel}" SelectedDate="{Binding AfterDate}" - ToolTip.Tip="Only delete messages sent after this date"> + ToolTip.Tip="{Binding LocalizationManager.DeleteAfterDateTooltip}">