From 51cc132e5d3485de6d73f950c607b283e5145ec5 Mon Sep 17 00:00:00 2001 From: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com> Date: Thu, 10 Feb 2022 17:23:32 +0200 Subject: [PATCH] Display 24-hour time pickers for appropriate cultures in GUI Related to #808 --- .../Utils/Internationalization.cs | 10 ++ .../Views/Dialogs/ExportSetupView.xaml | 115 +++++++++--------- 2 files changed, 69 insertions(+), 56 deletions(-) create mode 100644 DiscordChatExporter.Gui/Utils/Internationalization.cs diff --git a/DiscordChatExporter.Gui/Utils/Internationalization.cs b/DiscordChatExporter.Gui/Utils/Internationalization.cs new file mode 100644 index 00000000..8df9412f --- /dev/null +++ b/DiscordChatExporter.Gui/Utils/Internationalization.cs @@ -0,0 +1,10 @@ +using System.Globalization; + +namespace DiscordChatExporter.Gui.Utils; + +internal static class Internationalization +{ + public static bool Is24Hours => + string.IsNullOrWhiteSpace(CultureInfo.CurrentCulture.DateTimeFormat.AMDesignator) && + string.IsNullOrWhiteSpace(CultureInfo.CurrentCulture.DateTimeFormat.PMDesignator); +} \ No newline at end of file diff --git a/DiscordChatExporter.Gui/Views/Dialogs/ExportSetupView.xaml b/DiscordChatExporter.Gui/Views/Dialogs/ExportSetupView.xaml index 9a5d624e..94aa9e31 100644 --- a/DiscordChatExporter.Gui/Views/Dialogs/ExportSetupView.xaml +++ b/DiscordChatExporter.Gui/Views/Dialogs/ExportSetupView.xaml @@ -1,17 +1,18 @@  + xmlns:utils="clr-namespace:DiscordChatExporter.Gui.Utils" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> @@ -29,8 +30,8 @@ + Height="32" + Width="32"> @@ -38,12 +39,12 @@ @@ -51,12 +52,12 @@ @@ -68,21 +69,21 @@ + BorderThickness="0,1" + Grid.Row="1" + Padding="0,8"> + Style="{DynamicResource MaterialDesignOutlinedComboBox}" + materialDesign:HintAssist.Hint="Format" + materialDesign:HintAssist.IsFloating="True"> @@ -104,64 +105,66 @@ + ToolTip="Only include messages sent after this date" + materialDesign:HintAssist.Hint="After (date)" + materialDesign:HintAssist.IsFloating="True" /> + ToolTip="Only include messages sent before this date" + materialDesign:HintAssist.Hint="Before (date)" + materialDesign:HintAssist.IsFloating="True" /> + ToolTip="Only include messages sent after this time" + materialDesign:HintAssist.Hint="After (time)" + materialDesign:HintAssist.IsFloating="True" /> + ToolTip="Only include messages sent before this time" + materialDesign:HintAssist.Hint="Before (time)" + materialDesign:HintAssist.IsFloating="True" /> + ToolTip="Split output into partitions, each limited to this number of messages (e.g. '100') or file size (e.g. '10mb')" + materialDesign:HintAssist.Hint="Partition limit" + materialDesign:HintAssist.IsFloating="True" /> + ToolTip="Only include messages that satisfy this filter (e.g. 'from:foo#1234' or 'has:image')." + materialDesign:HintAssist.Hint="Message filter" + materialDesign:HintAssist.IsFloating="True" /> @@ -172,13 +175,13 @@ + Text="Download media" + VerticalAlignment="Center" /> + IsChecked="{Binding ShouldDownloadMedia}" + VerticalAlignment="Center" /> @@ -195,8 +198,8 @@