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.", "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(AdvancedOptionsTooltip)] = "Toggle advanced options",
[nameof(ExportButton)] = "EXPORT", [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 // Common buttons
[nameof(CloseButton)] = "CLOSE", [nameof(CloseButton)] = "CLOSE",
[nameof(CancelButton)] = "CANCEL", [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.", "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(AdvancedOptionsTooltip)] = "Basculer les options avancées",
[nameof(ExportButton)] = "EXPORTER", [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 // Common buttons
[nameof(CloseButton)] = "FERMER", [nameof(CloseButton)] = "FERMER",
[nameof(CancelButton)] = "ANNULER", [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.", "Assets in dieses Verzeichnis herunterladen. Wenn nicht angegeben, wird der Asset-Verzeichnispfad vom Ausgabepfad abgeleitet.",
[nameof(AdvancedOptionsTooltip)] = "Erweiterte Optionen umschalten", [nameof(AdvancedOptionsTooltip)] = "Erweiterte Optionen umschalten",
[nameof(ExportButton)] = "EXPORTIEREN", [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 // Common buttons
[nameof(CloseButton)] = "SCHLIESSEN", [nameof(CloseButton)] = "SCHLIESSEN",
[nameof(CancelButton)] = "ABBRECHEN", [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.", "Descargar recursos en este directorio. Si no se especifica, la ruta se derivará de la ruta de salida.",
[nameof(AdvancedOptionsTooltip)] = "Alternar opciones avanzadas", [nameof(AdvancedOptionsTooltip)] = "Alternar opciones avanzadas",
[nameof(ExportButton)] = "EXPORTAR", [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 // Common buttons
[nameof(CloseButton)] = "CERRAR", [nameof(CloseButton)] = "CERRAR",
[nameof(CancelButton)] = "CANCELAR", [nameof(CancelButton)] = "CANCELAR",

View file

@ -125,6 +125,19 @@ public partial class LocalizationManager
"Завантажувати ресурси до цієї директорії. Якщо не вказано, шлях до директорії ресурсів буде визначено з шляху збереження.", "Завантажувати ресурси до цієї директорії. Якщо не вказано, шлях до директорії ресурсів буде визначено з шляху збереження.",
[nameof(AdvancedOptionsTooltip)] = "Перемкнути розширені параметри", [nameof(AdvancedOptionsTooltip)] = "Перемкнути розширені параметри",
[nameof(ExportButton)] = "ЕКСПОРТУВАТИ", [nameof(ExportButton)] = "ЕКСПОРТУВАТИ",
// Delete Setup
[nameof(DeleteWarningTitle)] = "⚠ УВАГА: Це назавжди видалить повідомлення з каналу.",
[nameof(DeleteWarningSubtext)] =
"Ви можете видаляти лише власні повідомлення. Повідомлення інших користувачів буде пропущено.",
[nameof(DeleteAfterDateTooltip)] =
"Видаляти лише повідомлення, надіслані після цієї дати",
[nameof(DeleteBeforeDateTooltip)] =
"Видаляти лише повідомлення, надіслані до цієї дати",
[nameof(DeleteAfterTimeTooltip)] =
"Видаляти лише повідомлення, надіслані після цього часу",
[nameof(DeleteBeforeTimeTooltip)] =
"Видаляти лише повідомлення, надіслані до цього часу",
[nameof(DeleteButton)] = "ВИДАЛИТИ",
// Common buttons // Common buttons
[nameof(CloseButton)] = "ЗАКРИТИ", [nameof(CloseButton)] = "ЗАКРИТИ",
[nameof(CancelButton)] = "СКАСУВАТИ", [nameof(CancelButton)] = "СКАСУВАТИ",

View file

@ -143,6 +143,16 @@ public partial class LocalizationManager
public string AdvancedOptionsTooltip => Get(); public string AdvancedOptionsTooltip => Get();
public string ExportButton => 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 ---- // ---- Common buttons ----
public string CloseButton => Get(); public string CloseButton => Get();

View file

@ -5,11 +5,15 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using DiscordChatExporter.Core.Discord.Data; using DiscordChatExporter.Core.Discord.Data;
using DiscordChatExporter.Gui.Framework; using DiscordChatExporter.Gui.Framework;
using DiscordChatExporter.Gui.Localization;
namespace DiscordChatExporter.Gui.ViewModels.Dialogs; namespace DiscordChatExporter.Gui.ViewModels.Dialogs;
public partial class DeleteSetupViewModel : DialogViewModelBase public partial class DeleteSetupViewModel(LocalizationManager localizationManager)
: DialogViewModelBase
{ {
public LocalizationManager LocalizationManager { get; } = localizationManager;
[ObservableProperty] [ObservableProperty]
public partial Guild? Guild { get; set; } public partial Guild? Guild { get; set; }

View file

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