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.
This commit is contained in:
primetime43 2026-05-18 20:19:32 -04:00
parent 0794acd235
commit 2464610b05
8 changed files with 93 additions and 14 deletions

View file

@ -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",

View file

@ -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",

View file

@ -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",

View file

@ -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",

View file

@ -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)] = "СКАСУВАТИ",

View file

@ -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();

View file

@ -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; }

View file

@ -37,7 +37,7 @@
IsVisible="{Binding !IsSingleChannel}"
TextTrimming="CharacterEllipsis">
<Run Text="{Binding Channels.Count, FallbackValue=0, Mode=OneWay}" />
<Run Text="channels selected" />
<Run Text="{Binding LocalizationManager.ChannelsSelectedText}" />
</TextBlock>
<!-- Category and channel name (for single channel) -->
@ -78,9 +78,9 @@
FontWeight="SemiBold"
Foreground="#FFFFA500"
TextWrapping="Wrap">
<Run Text="⚠ WARNING: This will permanently delete messages from the channel." />
<Run Text="{Binding LocalizationManager.DeleteWarningTitle}" />
<LineBreak />
<Run FontWeight="Normal" Text="You can only delete your own messages. Messages from other users will be skipped." />
<Run FontWeight="Normal" Text="{Binding LocalizationManager.DeleteWarningSubtext}" />
</TextBlock>
</Border>
@ -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}">
<DatePicker.Styles>
<Style Selector="DatePicker">
<Style Selector="^ /template/ TextBox#DisplayTextBox">
@ -105,9 +105,9 @@
Grid.Row="0"
Grid.Column="1"
Margin="8,8,16,8"
materialAssists:TextFieldAssist.Label="Before (date)"
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.BeforeDateLabel}"
SelectedDate="{Binding BeforeDate}"
ToolTip.Tip="Only delete messages sent before this date">
ToolTip.Tip="{Binding LocalizationManager.DeleteBeforeDateTooltip}">
<DatePicker.Styles>
<Style Selector="DatePicker">
<Style Selector="^ /template/ TextBox#DisplayTextBox">
@ -122,11 +122,11 @@
Grid.Row="1"
Grid.Column="0"
Margin="16,8,8,8"
materialAssists:TextFieldAssist.Label="After (time)"
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.AfterTimeLabel}"
ClockIdentifier="{x:Static utils:Internationalization.AvaloniaClockIdentifier}"
IsEnabled="{Binding IsAfterDateSet}"
SelectedTime="{Binding AfterTime}"
ToolTip.Tip="Only delete messages sent after this time">
ToolTip.Tip="{Binding LocalizationManager.DeleteAfterTimeTooltip}">
<TimePicker.Styles>
<Style Selector="TimePicker">
<Style Selector="^ /template/ TextBox#PART_DisplayTextBox">
@ -139,11 +139,11 @@
Grid.Row="1"
Grid.Column="1"
Margin="8,8,16,8"
materialAssists:TextFieldAssist.Label="Before (time)"
materialAssists:TextFieldAssist.Label="{Binding LocalizationManager.BeforeTimeLabel}"
ClockIdentifier="{x:Static utils:Internationalization.AvaloniaClockIdentifier}"
IsEnabled="{Binding IsBeforeDateSet}"
SelectedTime="{Binding BeforeTime}"
ToolTip.Tip="Only delete messages sent before this time">
ToolTip.Tip="{Binding LocalizationManager.DeleteBeforeTimeTooltip}">
<TimePicker.Styles>
<Style Selector="TimePicker">
<Style Selector="^ /template/ TextBox#PART_DisplayTextBox">
@ -165,14 +165,14 @@
<Button
Grid.Column="1"
Command="{Binding ConfirmCommand}"
Content="DELETE"
Content="{Binding LocalizationManager.DeleteButton}"
IsDefault="True"
Theme="{DynamicResource MaterialOutlineButton}" />
<Button
Grid.Column="2"
Margin="16,0,0,0"
Command="{Binding CancelCommand}"
Content="CANCEL"
Content="{Binding LocalizationManager.CancelButton}"
IsCancel="True"
Theme="{DynamicResource MaterialOutlineButton}" />
</Grid>