More notification localizations

This commit is contained in:
Soreepeong 2024-02-28 01:05:47 +09:00
parent 18c1084fe3
commit 62af691419
3 changed files with 19 additions and 19 deletions

View file

@ -1,5 +1,7 @@
using System.Numerics;
using CheapLoc;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.Utility;
@ -21,10 +23,8 @@ internal static class NotificationConstants
// .. action buttons ..
// .................................
/// <summary>The string to show in place of this_plugin if the notification is shown by Dalamud.</summary>
public const string DefaultInitiator = "Dalamud";
/// <summary>The string to measure size of, to decide the width of notification windows.</summary>
/// <remarks>Probably not worth localizing.</remarks>
public const string NotificationWidthMeasurementString =
"The width of this text will decide the width\n" +
"of the notification window.";
@ -113,8 +113,12 @@ internal static class NotificationConstants
/// <summary>Gets the thickness of the focus indicator rectangle.</summary>
public static float FocusIndicatorThickness => MathF.Round(3 * ImGuiHelpers.GlobalScale);
/// <summary>Gets the string to show in place of this_plugin if the notification is shown by Dalamud.</summary>
public static string DefaultInitiator => Loc.Localize("NotificationConstants.DefaultInitiator", "Dalamud");
/// <summary>Gets the string format of the initiator name field, if the initiator is unloaded.</summary>
public static string UnloadedInitiatorNameFormat => "{0} (unloaded)";
public static string UnloadedInitiatorNameFormat =>
Loc.Localize("NotificationConstants.UnloadedInitiatorNameFormat", "{0} (unloaded)");
/// <summary>Gets the color corresponding to the notification type.</summary>
/// <param name="type">The notification type.</param>
@ -148,10 +152,10 @@ internal static class NotificationConstants
public static string? ToTitle(this NotificationType type) => type switch
{
NotificationType.None => null,
NotificationType.Success => NotificationType.Success.ToString(),
NotificationType.Warning => NotificationType.Warning.ToString(),
NotificationType.Error => NotificationType.Error.ToString(),
NotificationType.Info => NotificationType.Info.ToString(),
NotificationType.Success => Loc.Localize("NotificationConstants.Title.Success", "Success"),
NotificationType.Warning => Loc.Localize("NotificationConstants.Title.Warning", "Warning"),
NotificationType.Error => Loc.Localize("NotificationConstants.Title.Error", "Error"),
NotificationType.Info => Loc.Localize("NotificationConstants.Title.Info", "Info"),
_ => null,
};
}

View file

@ -70,7 +70,7 @@ public class Localization : IServiceType
public CultureInfo DalamudLanguageCultureInfo { get; private set; }
/// <summary>
/// Gets an instance of <see cref="CultureInfo"/> that corresponds to <paramref cref="langCode"/>.
/// Gets an instance of <see cref="CultureInfo"/> that corresponds to <paramref name="langCode"/>.
/// </summary>
/// <param name="langCode">The language code which should be in <see cref="ApplicableLangCodes"/>.</param>
/// <returns>The corresponding instance of <see cref="CultureInfo"/>.</returns>

View file

@ -11,7 +11,7 @@ namespace Dalamud.Utility;
/// <summary>
/// Utility functions for <see cref="DateTime"/> and <see cref="TimeSpan"/>.
/// </summary>
internal static class DateTimeSpanExtensions
public static class DateTimeSpanExtensions
{
private static readonly ModuleLog Log = new(nameof(DateTimeSpanExtensions));
@ -34,16 +34,12 @@ internal static class DateTimeSpanExtensions
var region = 0;
if (framework is not null)
region = framework->Region;
switch (region)
return region switch
{
case 0: // jp
default:
return when.ToString("yyyy-MM-dd HH:mm:ss");
case 1: // na
return when.ToString("MM/dd/yyyy HH:mm:ss");
case 2: // eu
return when.ToString("dd-mm-yyyy HH:mm:ss");
}
1 => when.ToString("MM/dd/yyyy HH:mm:ss"), // na
2 => when.ToString("dd-mm-yyyy HH:mm:ss"), // eu
_ => when.ToString("yyyy-MM-dd HH:mm:ss"), // jp(0), cn(3), kr(4), and other possible errorneous cases
};
}
/// <summary>Formats an instance of <see cref="DateTime"/> as a localized relative time.</summary>