Préparation traduction en => fr Part1

This commit is contained in:
2025-09-21 11:27:23 +02:00
parent 17aa6e247c
commit fe731ff670
23 changed files with 1815 additions and 676 deletions

View File

@@ -63,6 +63,8 @@ public class CompactUi : WindowMediatorSubscriberBase
private bool _nearbyOpen = true;
private List<Services.Mediator.NearbyEntry> _nearbyEntries = new();
private string L(string key, string fallback, params object[] args) => _uiSharedService.Localize(key, fallback, args);
public CompactUi(ILogger<CompactUi> logger, UiSharedService uiShared, MareConfigService configService, ApiController apiController, PairManager pairManager, ChatService chatService,
ServerConfigurationManager serverManager, MareMediator mediator, FileUploadManager fileTransferManager, UidDisplayHandler uidDisplayHandler, CharaDataManager charaDataManager,
NearbyPendingService nearbyPendingService,
@@ -84,7 +86,7 @@ public class CompactUi : WindowMediatorSubscriberBase
_groupPanel = new(this, uiShared, _pairManager, chatService, uidDisplayHandler, _configService, _serverManager, _charaDataManager);
_selectGroupForPairUi = new(tagHandler, uidDisplayHandler, _uiSharedService);
_selectPairsForGroupUi = new(tagHandler, uidDisplayHandler);
_selectPairsForGroupUi = new(tagHandler, uidDisplayHandler, _uiSharedService);
_pairGroupsUi = new(configService, tagHandler, uidDisplayHandler, apiController, _selectPairsForGroupUi, _uiSharedService);
#if DEBUG
@@ -121,7 +123,7 @@ public class CompactUi : WindowMediatorSubscriberBase
if (!_apiController.IsCurrentVersion)
{
var ver = _apiController.CurrentClientVersion;
var unsupported = "UNSUPPORTED VERSION";
var unsupported = L("Compact.Version.UnsupportedTitle", "UNSUPPORTED VERSION");
using (_uiSharedService.UidFont.Push())
{
var uidTextSize = ImGui.CalcTextSize(unsupported);
@@ -129,8 +131,10 @@ public class CompactUi : WindowMediatorSubscriberBase
ImGui.AlignTextToFramePadding();
ImGui.TextColored(ImGuiColors.DalamudRed, unsupported);
}
UiSharedService.ColorTextWrapped($"Your UmbraSync installation is out of date, the current version is {ver.Major}.{ver.Minor}.{ver.Build}. " +
$"It is highly recommended to keep UmbraSync up to date. Open /xlplugins and update the plugin.", ImGuiColors.DalamudRed);
UiSharedService.ColorTextWrapped(L("Compact.Version.Outdated",
"Your UmbraSync installation is out of date, the current version is {0}.{1}.{2}. It is highly recommended to keep UmbraSync up to date. Open /xlplugins and update the plugin.",
ver.Major, ver.Minor, ver.Build),
ImGuiColors.DalamudRed);
}
using (ImRaii.PushId("header")) DrawUIDHeader();
@@ -155,7 +159,7 @@ public class CompactUi : WindowMediatorSubscriberBase
ImGui.PopStyleColor();
}
ImGui.PopFont();
UiSharedService.AttachToolTip("Individual pairs");
UiSharedService.AttachToolTip(L("Compact.Toggle.IndividualPairs", "Individual pairs"));
ImGui.SameLine();
@@ -174,7 +178,7 @@ public class CompactUi : WindowMediatorSubscriberBase
}
ImGui.PopFont();
UiSharedService.AttachToolTip("Syncshells");
UiSharedService.AttachToolTip(L("Compact.Toggle.Syncshells", "Syncshells"));
ImGui.Separator();
if (!hasShownSyncShells)
@@ -196,12 +200,14 @@ public class CompactUi : WindowMediatorSubscriberBase
{
_lastAddedUser = _pairManager.LastAddedUser;
_pairManager.LastAddedUser = null;
ImGui.OpenPopup("Set Notes for New User");
var setNotesTitle = L("Compact.AddUser.ModalTitle", "Set Notes for New User");
ImGui.OpenPopup(setNotesTitle);
_showModalForUserAddition = true;
_lastAddedUserComment = string.Empty;
}
if (ImGui.BeginPopupModal("Set Notes for New User", ref _showModalForUserAddition, UiSharedService.PopupWindowFlags))
var setNotesModalTitle = L("Compact.AddUser.ModalTitle", "Set Notes for New User");
if (ImGui.BeginPopupModal(setNotesModalTitle, ref _showModalForUserAddition, UiSharedService.PopupWindowFlags))
{
if (_lastAddedUser == null)
{
@@ -209,9 +215,9 @@ public class CompactUi : WindowMediatorSubscriberBase
}
else
{
UiSharedService.TextWrapped($"You have successfully added {_lastAddedUser.UserData.AliasOrUID}. Set a local note for the user in the field below:");
ImGui.InputTextWithHint("##noteforuser", $"Note for {_lastAddedUser.UserData.AliasOrUID}", ref _lastAddedUserComment, 100);
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Save, "Save Note"))
UiSharedService.TextWrapped(L("Compact.AddUser.Description", "You have successfully added {0}. Set a local note for the user in the field below:", _lastAddedUser.UserData.AliasOrUID));
ImGui.InputTextWithHint("##noteforuser", L("Compact.AddUser.NoteHint", "Note for {0}", _lastAddedUser.UserData.AliasOrUID), ref _lastAddedUserComment, 100);
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Save, L("Compact.AddUser.Save", "Save Note")))
{
_serverManager.SetNoteForUid(_lastAddedUser.UserData.UID, _lastAddedUserComment);
_lastAddedUser = null;
@@ -246,7 +252,7 @@ public class CompactUi : WindowMediatorSubscriberBase
if (keys.Any())
{
if (_secretKeyIdx == -1) _secretKeyIdx = keys.First().Key;
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Plus, "Add current character with secret key"))
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Plus, L("Compact.AddCharacter.Button", "Add current character with secret key")))
{
_serverManager.CurrentServer!.Authentications.Add(new MareConfiguration.Models.Authentication()
{
@@ -260,11 +266,11 @@ public class CompactUi : WindowMediatorSubscriberBase
_ = _apiController.CreateConnections();
}
_uiSharedService.DrawCombo("Secret Key##addCharacterSecretKey", keys, (f) => f.Value.FriendlyName, (f) => _secretKeyIdx = f.Key);
_uiSharedService.DrawCombo(L("Compact.AddCharacter.SecretKeyLabel", "Secret Key") + "##addCharacterSecretKey", keys, (f) => f.Value.FriendlyName, (f) => _secretKeyIdx = f.Key);
}
else
{
UiSharedService.ColorTextWrapped("No secret keys are configured for the current server.", ImGuiColors.DalamudYellow);
UiSharedService.ColorTextWrapped(L("Compact.AddCharacter.NoKeys", "No secret keys are configured for the current server."), ImGuiColors.DalamudYellow);
}
}
@@ -272,7 +278,7 @@ public class CompactUi : WindowMediatorSubscriberBase
{
var buttonSize = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Plus);
ImGui.SetNextItemWidth(UiSharedService.GetWindowContentRegionWidth() - ImGui.GetWindowContentRegionMin().X - buttonSize.X);
ImGui.InputTextWithHint("##otheruid", "Other players UID/Alias", ref _pairToAdd, 20);
ImGui.InputTextWithHint("##otheruid", L("Compact.AddPair.Hint", "Other player's UID/Alias"), ref _pairToAdd, 20);
ImGui.SameLine(ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth() - buttonSize.X);
var canAdd = !_pairManager.DirectPairs.Any(p => string.Equals(p.UserData.UID, _pairToAdd, StringComparison.Ordinal) || string.Equals(p.UserData.Alias, _pairToAdd, StringComparison.Ordinal));
using (ImRaii.Disabled(!canAdd))
@@ -282,7 +288,7 @@ public class CompactUi : WindowMediatorSubscriberBase
_ = _apiController.UserAddPair(new(new(_pairToAdd)));
_pairToAdd = string.Empty;
}
UiSharedService.AttachToolTip("Pair with " + (_pairToAdd.IsNullOrEmpty() ? "other user" : _pairToAdd));
UiSharedService.AttachToolTip(L("Compact.AddPair.Tooltip", "Pair with {0}", _pairToAdd.IsNullOrEmpty() ? L("Compact.AddPair.Tooltip.DefaultUser", "other user") : _pairToAdd));
}
ImGuiHelpers.ScaledDummy(2);
@@ -300,7 +306,7 @@ public class CompactUi : WindowMediatorSubscriberBase
: 0;
ImGui.SetNextItemWidth(WindowContentWidth - spacing);
ImGui.InputTextWithHint("##filter", "Filter for UID/notes", ref _characterOrCommentFilter, 255);
ImGui.InputTextWithHint("##filter", L("Compact.Filter.Hint", "Filter for UID/notes"), ref _characterOrCommentFilter, 255);
if (userCount == 0) return;
@@ -349,9 +355,12 @@ public class CompactUi : WindowMediatorSubscriberBase
_buttonState = !_buttonState;
}
if (!_timeout.IsRunning)
UiSharedService.AttachToolTip($"Hold Control to {(button == FontAwesomeIcon.Play ? "resume" : "pause")} pairing with {users.Count} out of {userCount} displayed users.");
UiSharedService.AttachToolTip(L("Compact.Filter.ToggleTooltip", "Hold Control to {0} pairing with {1} out of {2} displayed users.",
button == FontAwesomeIcon.Play ? L("Compact.Filter.ToggleTooltip.Resume", "resume") : L("Compact.Filter.ToggleTooltip.Pause", "pause"),
users.Count, userCount));
else
UiSharedService.AttachToolTip($"Next execution is available at {(5000 - _timeout.ElapsedMilliseconds) / 1000} seconds");
UiSharedService.AttachToolTip(L("Compact.Filter.CooldownTooltip", "Next execution is available at {0} seconds",
(5000 - _timeout.ElapsedMilliseconds) / 1000));
}
}
@@ -388,13 +397,14 @@ public class CompactUi : WindowMediatorSubscriberBase
if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) _nearbyOpen = !_nearbyOpen;
ImGui.SameLine();
var onUmbra = _nearbyEntries?.Count(e => e.IsMatch) ?? 0;
ImGui.TextUnformatted($"Nearby ({onUmbra})");
ImGui.TextUnformatted(L("Compact.Nearby.Title", "Nearby ({0})", onUmbra));
if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) _nearbyOpen = !_nearbyOpen;
var btnWidth = _uiSharedService.GetIconTextButtonSize(FontAwesomeIcon.UserPlus, "Nearby");
var nearbyButtonLabel = L("Compact.Nearby.Button", "Nearby");
var btnWidth = _uiSharedService.GetIconTextButtonSize(FontAwesomeIcon.UserPlus, nearbyButtonLabel);
var headerRight = ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth();
ImGui.SameLine();
ImGui.SetCursorPosX(headerRight - btnWidth);
if (_uiSharedService.IconTextButton(FontAwesomeIcon.UserPlus, "Nearby", btnWidth))
if (_uiSharedService.IconTextButton(FontAwesomeIcon.UserPlus, nearbyButtonLabel, btnWidth))
{
Mediator.Publish(new UiToggleMessage(typeof(AutoDetectUi)));
}
@@ -409,7 +419,7 @@ public class CompactUi : WindowMediatorSubscriberBase
.ToList();
if (nearby.Count == 0)
{
UiSharedService.ColorTextWrapped("No nearby players detected.", ImGuiColors.DalamudGrey3);
UiSharedService.ColorTextWrapped(L("Compact.Nearby.None", "No nearby players detected."), ImGuiColors.DalamudGrey3);
}
else
{
@@ -438,12 +448,12 @@ public class CompactUi : WindowMediatorSubscriberBase
if (isPaired)
{
_uiSharedService.IconText(FontAwesomeIcon.Check, ImGuiColors.ParsedGreen);
UiSharedService.AttachToolTip("Déjà apparié sur Umbra");
UiSharedService.AttachToolTip(L("Compact.Nearby.Tooltip.AlreadyPaired", "Already paired on Umbra"));
}
else if (!e.AcceptPairRequests)
{
_uiSharedService.IconText(FontAwesomeIcon.Ban, ImGuiColors.DalamudGrey3);
UiSharedService.AttachToolTip("Les demandes sont désactivées pour ce joueur");
UiSharedService.AttachToolTip(L("Compact.Nearby.Tooltip.RequestsDisabled", "Pair requests are disabled for this player"));
}
else if (!string.IsNullOrEmpty(e.Token))
{
@@ -451,12 +461,12 @@ public class CompactUi : WindowMediatorSubscriberBase
{
_ = _autoDetectRequestService.SendRequestAsync(e.Token!);
}
UiSharedService.AttachToolTip("Envoyer une invitation Umbra");
UiSharedService.AttachToolTip(L("Compact.Nearby.Tooltip.SendInvite", "Send Umbra invitation"));
}
else
{
_uiSharedService.IconText(FontAwesomeIcon.QuestionCircle, ImGuiColors.DalamudGrey3);
UiSharedService.AttachToolTip("Impossible d'inviter ce joueur");
UiSharedService.AttachToolTip(L("Compact.Nearby.Tooltip.CannotInvite", "Unable to invite this player"));
}
}
}
@@ -466,23 +476,23 @@ public class CompactUi : WindowMediatorSubscriberBase
if (inbox != null && inbox.Pending.Count > 0)
{
ImGuiHelpers.ScaledDummy(6);
_uiSharedService.BigText("Incoming requests");
_uiSharedService.BigText(L("Compact.Nearby.Incoming", "Incoming requests"));
foreach (var kv in inbox.Pending)
{
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted($"{kv.Value} [{kv.Key}]");
ImGui.TextUnformatted(L("Compact.Nearby.Incoming.Entry", "{0} [{1}]", kv.Value, kv.Key));
ImGui.SameLine();
if (_uiSharedService.IconButton(FontAwesomeIcon.Check))
{
_ = inbox.AcceptAsync(kv.Key);
}
UiSharedService.AttachToolTip("Accept and add as pair");
UiSharedService.AttachToolTip(L("Compact.Nearby.Incoming.Accept", "Accept and add as pair"));
ImGui.SameLine();
if (_uiSharedService.IconButton(FontAwesomeIcon.Times))
{
inbox.Remove(kv.Key);
}
UiSharedService.AttachToolTip("Dismiss request");
UiSharedService.AttachToolTip(L("Compact.Nearby.Incoming.Dismiss", "Dismiss request"));
}
}
}
@@ -501,8 +511,11 @@ public class CompactUi : WindowMediatorSubscriberBase
var buttonSize = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Link);
var userCount = _apiController.OnlineUsers.ToString(CultureInfo.InvariantCulture);
var userSize = ImGui.CalcTextSize(userCount);
var textSize = ImGui.CalcTextSize("Users Online");
string shardConnection = string.Equals(_apiController.ServerInfo.ShardName, "Main", StringComparison.OrdinalIgnoreCase) ? string.Empty : $"Shard: {_apiController.ServerInfo.ShardName}";
var usersOnlineText = L("Compact.ServerStatus.UsersOnline", "Users Online");
var textSize = ImGui.CalcTextSize(usersOnlineText);
string shardConnection = string.Equals(_apiController.ServerInfo.ShardName, "Main", StringComparison.OrdinalIgnoreCase)
? string.Empty
: L("Compact.ServerStatus.Shard", "Shard: {0}", _apiController.ServerInfo.ShardName);
var shardTextSize = ImGui.CalcTextSize(shardConnection);
var printShard = !string.IsNullOrEmpty(_apiController.ServerInfo.ShardName) && shardConnection != string.Empty;
@@ -513,12 +526,12 @@ public class CompactUi : WindowMediatorSubscriberBase
ImGui.TextColored(UiSharedService.AccentColor, userCount);
ImGui.SameLine();
if (!printShard) ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted("Users Online");
ImGui.TextUnformatted(usersOnlineText);
}
else
{
ImGui.AlignTextToFramePadding();
ImGui.TextColored(ImGuiColors.DalamudRed, "Not connected to any server");
ImGui.TextColored(ImGuiColors.DalamudRed, L("Compact.ServerStatus.NotConnected", "Not connected to any server"));
}
if (printShard)
@@ -544,7 +557,7 @@ public class CompactUi : WindowMediatorSubscriberBase
{
Mediator.Publish(new UiToggleMessage(typeof(EditProfileUi)));
}
UiSharedService.AttachToolTip("Edit your Profile");
UiSharedService.AttachToolTip(L("Compact.ServerStatus.EditProfile", "Edit your Profile"));
}
ImGui.SameLine(ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth() - buttonSize.X);
@@ -563,7 +576,9 @@ public class CompactUi : WindowMediatorSubscriberBase
_ = _apiController.CreateConnections();
}
ImGui.PopStyleColor();
UiSharedService.AttachToolTip(!_serverManager.CurrentServer.FullPause ? "Disconnect from " + _serverManager.CurrentServer.ServerName : "Connect to " + _serverManager.CurrentServer.ServerName);
UiSharedService.AttachToolTip(!_serverManager.CurrentServer.FullPause
? L("Compact.ServerStatus.Disconnect", "Disconnect from {0}", _serverManager.CurrentServer.ServerName)
: L("Compact.ServerStatus.Connect", "Connect to {0}", _serverManager.CurrentServer.ServerName));
}
}
@@ -612,13 +627,13 @@ public class CompactUi : WindowMediatorSubscriberBase
}
var spacing = ImGui.GetStyle().ItemSpacing.X;
var bottomButtonWidth = (WindowContentWidth - spacing) / 2f;
if (_uiSharedService.IconTextButton(FontAwesomeIcon.PersonCircleQuestion, "Character Analysis", bottomButtonWidth))
if (_uiSharedService.IconTextButton(FontAwesomeIcon.PersonCircleQuestion, L("Compact.Transfers.CharacterAnalysis", "Character Analysis"), bottomButtonWidth))
{
Mediator.Publish(new UiToggleMessage(typeof(DataAnalysisUi)));
}
ImGui.SameLine();
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Running, "Character Data Hub", bottomButtonWidth))
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Running, L("Compact.Transfers.CharacterDataHub", "Character Data Hub"), bottomButtonWidth))
{
Mediator.Publish(new UiToggleMessage(typeof(CharaDataHubUi)));
}
@@ -646,7 +661,7 @@ public class CompactUi : WindowMediatorSubscriberBase
{
Mediator.Publish(new OpenSettingsUiMessage());
}
UiSharedService.AttachToolTip("Open the UmbraSync Settings");
UiSharedService.AttachToolTip(L("Compact.Header.SettingsTooltip", "Open the UmbraSync settings"));
ImGui.SameLine();
ImGui.SetCursorPos(originalPos);
@@ -659,7 +674,7 @@ public class CompactUi : WindowMediatorSubscriberBase
{
ImGui.SetClipboardText(_apiController.DisplayName);
}
UiSharedService.AttachToolTip("Copy your UID to clipboard");
UiSharedService.AttachToolTip(L("Compact.Header.CopyUid", "Copy your UID to clipboard"));
ImGui.SameLine();
}
ImGui.SetWindowFontScale(1f);
@@ -694,18 +709,19 @@ public class CompactUi : WindowMediatorSubscriberBase
{
return _apiController.ServerState switch
{
ServerState.Connecting => "Attempting to connect to the server.",
ServerState.Reconnecting => "Connection to server interrupted, attempting to reconnect to the server.",
ServerState.Disconnected => "You are currently disconnected from the sync server.",
ServerState.Disconnecting => "Disconnecting from the server",
ServerState.Unauthorized => "Server Response: " + _apiController.AuthFailureMessage,
ServerState.Offline => "Your selected sync server is currently offline.",
ServerState.Connecting => L("Compact.ServerError.Connecting", "Attempting to connect to the server."),
ServerState.Reconnecting => L("Compact.ServerError.Reconnecting", "Connection to server interrupted, attempting to reconnect to the server."),
ServerState.Disconnected => L("Compact.ServerError.Disconnected", "You are currently disconnected from the sync server."),
ServerState.Disconnecting => L("Compact.ServerError.Disconnecting", "Disconnecting from the server"),
ServerState.Unauthorized => L("Compact.ServerError.Unauthorized", "Server Response: {0}", _apiController.AuthFailureMessage),
ServerState.Offline => L("Compact.ServerError.Offline", "Your selected sync server is currently offline."),
ServerState.VersionMisMatch =>
"Your plugin or the server you are connecting to is out of date. Please update your plugin now. If you already did so, contact the server provider to update their server to the latest version.",
ServerState.RateLimited => "You are rate limited for (re)connecting too often. Disconnect, wait 10 minutes and try again.",
L("Compact.ServerError.VersionMismatch",
"Your plugin or the server you are connecting to is out of date. Please update your plugin now. If you already did so, contact the server provider to update their server to the latest version."),
ServerState.RateLimited => L("Compact.ServerError.RateLimited", "You are rate limited for (re)connecting too often. Disconnect, wait 10 minutes and try again."),
ServerState.Connected => string.Empty,
ServerState.NoSecretKey => "You have no secret key set for this current character. Use the button below or open the settings and set a secret key for the current character. You can reuse the same secret key for multiple characters.",
ServerState.MultiChara => "Your Character Configuration has multiple characters configured with same name and world. You will not be able to connect until you fix this issue. Remove the duplicates from the configuration in Settings -> Service Settings -> Character Management and reconnect manually after.",
ServerState.NoSecretKey => L("Compact.ServerError.NoSecretKey", "You have no secret key set for this current character. Use the button below or open the settings and set a secret key for the current character. You can reuse the same secret key for multiple characters."),
ServerState.MultiChara => L("Compact.ServerError.MultiChara", "Your Character Configuration has multiple characters configured with same name and world. You will not be able to connect until you fix this issue. Remove the duplicates from the configuration in Settings -> Service Settings -> Character Management and reconnect manually after."),
_ => string.Empty
};
}
@@ -733,16 +749,16 @@ public class CompactUi : WindowMediatorSubscriberBase
{
return _apiController.ServerState switch
{
ServerState.Reconnecting => "Reconnecting",
ServerState.Connecting => "Connecting",
ServerState.Disconnected => "Disconnected",
ServerState.Disconnecting => "Disconnecting",
ServerState.Unauthorized => "Unauthorized",
ServerState.VersionMisMatch => "Version mismatch",
ServerState.Offline => "Unavailable",
ServerState.RateLimited => "Rate Limited",
ServerState.NoSecretKey => "No Secret Key",
ServerState.MultiChara => "Duplicate Characters",
ServerState.Reconnecting => L("Compact.UidText.Reconnecting", "Reconnecting"),
ServerState.Connecting => L("Compact.UidText.Connecting", "Connecting"),
ServerState.Disconnected => L("Compact.UidText.Disconnected", "Disconnected"),
ServerState.Disconnecting => L("Compact.UidText.Disconnecting", "Disconnecting"),
ServerState.Unauthorized => L("Compact.UidText.Unauthorized", "Unauthorized"),
ServerState.VersionMisMatch => L("Compact.UidText.VersionMismatch", "Version mismatch"),
ServerState.Offline => L("Compact.UidText.Offline", "Unavailable"),
ServerState.RateLimited => L("Compact.UidText.RateLimited", "Rate Limited"),
ServerState.NoSecretKey => L("Compact.UidText.NoSecretKey", "No Secret Key"),
ServerState.MultiChara => L("Compact.UidText.MultiChara", "Duplicate Characters"),
ServerState.Connected => _apiController.DisplayName,
_ => string.Empty
};