Replace the date format option with a locale option (#1130)

This commit is contained in:
Oleksii Holub
2023-09-07 14:34:08 +03:00
committed by GitHub
parent 53b11d6c49
commit 59344cedbe
22 changed files with 288 additions and 273 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@@ -88,7 +89,7 @@ public abstract class ExportCommandBase : DiscordCommandBase
"media",
Description = "Download assets referenced by the export (user avatars, attached files, embedded images, etc.)."
)]
public bool ShouldDownloadAssets { get; init; } = false;
public bool ShouldDownloadAssets { get; init; }
[CommandOption(
"reuse-media",
@@ -111,9 +112,19 @@ public abstract class ExportCommandBase : DiscordCommandBase
init => _assetsDirPath = value is not null ? Path.GetFullPath(value) : null;
}
[CommandOption("dateformat", Description = "Format used when writing dates.")]
[Obsolete("This option doesn't do anything. Kept for backwards compatibility.")]
[CommandOption(
"dateformat",
Description = "This option doesn't do anything. Kept for backwards compatibility."
)]
public string DateFormat { get; init; } = "MM/dd/yyyy h:mm tt";
[CommandOption("locale", Description = "Locale to use when formatting dates and numbers.")]
public string Locale { get; init; } = CultureInfo.CurrentCulture.Name;
[CommandOption("utc", Description = "Normalize all timestamps to UTC+0.")]
public bool IsUtcNormalizationEnabled { get; init; } = false;
[CommandOption(
"fuck-russia",
EnvironmentVariable = "FUCK_RUSSIA",
@@ -210,7 +221,8 @@ public abstract class ExportCommandBase : DiscordCommandBase
ShouldFormatMarkdown,
ShouldDownloadAssets,
ShouldReuseAssets,
DateFormat
Locale,
IsUtcNormalizationEnabled
);
await Exporter.ExportChannelAsync(