mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-20 23:07:43 +01:00
More notification localizations
This commit is contained in:
parent
18c1084fe3
commit
62af691419
3 changed files with 19 additions and 19 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
|
using CheapLoc;
|
||||||
|
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
using Dalamud.Interface.Internal.Notifications;
|
using Dalamud.Interface.Internal.Notifications;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
|
|
@ -21,10 +23,8 @@ internal static class NotificationConstants
|
||||||
// .. action buttons ..
|
// .. 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>
|
/// <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 =
|
public const string NotificationWidthMeasurementString =
|
||||||
"The width of this text will decide the width\n" +
|
"The width of this text will decide the width\n" +
|
||||||
"of the notification window.";
|
"of the notification window.";
|
||||||
|
|
@ -113,8 +113,12 @@ internal static class NotificationConstants
|
||||||
/// <summary>Gets the thickness of the focus indicator rectangle.</summary>
|
/// <summary>Gets the thickness of the focus indicator rectangle.</summary>
|
||||||
public static float FocusIndicatorThickness => MathF.Round(3 * ImGuiHelpers.GlobalScale);
|
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>
|
/// <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>
|
/// <summary>Gets the color corresponding to the notification type.</summary>
|
||||||
/// <param name="type">The notification type.</param>
|
/// <param name="type">The notification type.</param>
|
||||||
|
|
@ -148,10 +152,10 @@ internal static class NotificationConstants
|
||||||
public static string? ToTitle(this NotificationType type) => type switch
|
public static string? ToTitle(this NotificationType type) => type switch
|
||||||
{
|
{
|
||||||
NotificationType.None => null,
|
NotificationType.None => null,
|
||||||
NotificationType.Success => NotificationType.Success.ToString(),
|
NotificationType.Success => Loc.Localize("NotificationConstants.Title.Success", "Success"),
|
||||||
NotificationType.Warning => NotificationType.Warning.ToString(),
|
NotificationType.Warning => Loc.Localize("NotificationConstants.Title.Warning", "Warning"),
|
||||||
NotificationType.Error => NotificationType.Error.ToString(),
|
NotificationType.Error => Loc.Localize("NotificationConstants.Title.Error", "Error"),
|
||||||
NotificationType.Info => NotificationType.Info.ToString(),
|
NotificationType.Info => Loc.Localize("NotificationConstants.Title.Info", "Info"),
|
||||||
_ => null,
|
_ => null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ public class Localization : IServiceType
|
||||||
public CultureInfo DalamudLanguageCultureInfo { get; private set; }
|
public CultureInfo DalamudLanguageCultureInfo { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
/// <param name="langCode">The language code which should be in <see cref="ApplicableLangCodes"/>.</param>
|
/// <param name="langCode">The language code which should be in <see cref="ApplicableLangCodes"/>.</param>
|
||||||
/// <returns>The corresponding instance of <see cref="CultureInfo"/>.</returns>
|
/// <returns>The corresponding instance of <see cref="CultureInfo"/>.</returns>
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace Dalamud.Utility;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Utility functions for <see cref="DateTime"/> and <see cref="TimeSpan"/>.
|
/// Utility functions for <see cref="DateTime"/> and <see cref="TimeSpan"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static class DateTimeSpanExtensions
|
public static class DateTimeSpanExtensions
|
||||||
{
|
{
|
||||||
private static readonly ModuleLog Log = new(nameof(DateTimeSpanExtensions));
|
private static readonly ModuleLog Log = new(nameof(DateTimeSpanExtensions));
|
||||||
|
|
||||||
|
|
@ -34,16 +34,12 @@ internal static class DateTimeSpanExtensions
|
||||||
var region = 0;
|
var region = 0;
|
||||||
if (framework is not null)
|
if (framework is not null)
|
||||||
region = framework->Region;
|
region = framework->Region;
|
||||||
switch (region)
|
return region switch
|
||||||
{
|
{
|
||||||
case 0: // jp
|
1 => when.ToString("MM/dd/yyyy HH:mm:ss"), // na
|
||||||
default:
|
2 => when.ToString("dd-mm-yyyy HH:mm:ss"), // eu
|
||||||
return when.ToString("yyyy-MM-dd HH:mm:ss");
|
_ => when.ToString("yyyy-MM-dd HH:mm:ss"), // jp(0), cn(3), kr(4), and other possible errorneous cases
|
||||||
case 1: // na
|
};
|
||||||
return when.ToString("MM/dd/yyyy HH:mm:ss");
|
|
||||||
case 2: // eu
|
|
||||||
return when.ToString("dd-mm-yyyy HH:mm:ss");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Formats an instance of <see cref="DateTime"/> as a localized relative time.</summary>
|
/// <summary>Formats an instance of <see cref="DateTime"/> as a localized relative time.</summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue