mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-28 16:57:02 +00:00
Use null as the default locale, which resolves to the current system default locale (#1185)
This commit is contained in:
@@ -9,13 +9,15 @@ public class LocaleToDisplayNameConverter : IValueConverter
|
||||
{
|
||||
public static LocaleToDisplayNameConverter Instance { get; } = new();
|
||||
|
||||
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
|
||||
value is string locale ? CultureInfo.GetCultureInfo(locale).DisplayName : null;
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) =>
|
||||
value is string locale && !string.IsNullOrWhiteSpace(locale)
|
||||
? CultureInfo.GetCultureInfo(locale).DisplayName
|
||||
: "System default";
|
||||
|
||||
public object ConvertBack(
|
||||
object value,
|
||||
object? value,
|
||||
Type targetType,
|
||||
object parameter,
|
||||
object? parameter,
|
||||
CultureInfo culture
|
||||
) => throw new NotSupportedException();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user