Préparation traduction en => fr Part1
This commit is contained in:
@@ -11,6 +11,8 @@ using MareSynchronos.WebAPI;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Runtime.InteropServices;
|
||||
using MareSynchronos.Localization;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MareSynchronos.UI;
|
||||
|
||||
@@ -46,6 +48,13 @@ public sealed class DtrEntry : IDisposable, IHostedService
|
||||
private string? _tooltip;
|
||||
private Colors _colors;
|
||||
|
||||
private static string L(string key, string fallback, params object[] args)
|
||||
{
|
||||
var safeArgs = args ?? Array.Empty<object>();
|
||||
return LocalizationService.Instance?.GetString(key, fallback, safeArgs)
|
||||
?? string.Format(CultureInfo.CurrentCulture, fallback, safeArgs);
|
||||
}
|
||||
|
||||
public DtrEntry(ILogger<DtrEntry> logger, IDtrBar dtrBar, MareConfigService configService, MareMediator mareMediator, PairManager pairManager, ApiController apiController)
|
||||
{
|
||||
_logger = logger;
|
||||
@@ -106,7 +115,7 @@ public sealed class DtrEntry : IDisposable, IHostedService
|
||||
private IDtrBarEntry CreateEntry()
|
||||
{
|
||||
_logger.LogTrace("Creating new DtrBar entry");
|
||||
var entry = _dtrBar.Get("Umbra");
|
||||
var entry = _dtrBar.Get(L("DtrEntry.EntryName", "Umbra"));
|
||||
entry.OnClick = _ => _mareMediator.Publish(new UiToggleMessage(typeof(CompactUi)));
|
||||
|
||||
return entry;
|
||||
@@ -165,19 +174,20 @@ public sealed class DtrEntry : IDisposable, IHostedService
|
||||
.Select(x => string.Format("{0}", _configService.Current.PreferNoteInDtrTooltip ? x.GetNoteOrName() : x.PlayerName));
|
||||
}
|
||||
|
||||
tooltip = $"Umbra: Connected{Environment.NewLine}----------{Environment.NewLine}{string.Join(Environment.NewLine, visiblePairs)}";
|
||||
var header = L("DtrEntry.Tooltip.Connected", "Umbra: Connected");
|
||||
tooltip = header + Environment.NewLine + "----------" + Environment.NewLine + string.Join(Environment.NewLine, visiblePairs);
|
||||
colors = _configService.Current.DtrColorsPairsInRange;
|
||||
}
|
||||
else
|
||||
{
|
||||
tooltip = "Umbra: Connected";
|
||||
tooltip = L("DtrEntry.Tooltip.Connected", "Umbra: Connected");
|
||||
colors = _configService.Current.DtrColorsDefault;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
text = RenderDtrStyle(_configService.Current.DtrStyle, "\uE04C");
|
||||
tooltip = "Umbra: Not Connected";
|
||||
tooltip = L("DtrEntry.Tooltip.Disconnected", "Umbra: Not Connected");
|
||||
colors = _configService.Current.DtrColorsNotConnected;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user