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

@@ -143,16 +143,16 @@ public class SettingsUi : WindowMediatorSubscriberBase
private void DrawBlockedTransfers()
{
_lastTab = "BlockedTransfers";
UiSharedService.ColorTextWrapped("Files that you attempted to upload or download that were forbidden to be transferred by their creators will appear here. " +
"If you see file paths from your drive here, then those files were not allowed to be uploaded. If you see hashes, those files were not allowed to be downloaded. " +
"Ask your paired friend to send you the mod in question through other means or acquire the mod yourself.",
UiSharedService.ColorTextWrapped(L("Settings.Transfers.Blocked.Description",
"Files that you attempted to upload or download that were forbidden to be transferred by their creators will appear here. " +
"If you see file paths from your drive here, then those files were not allowed to be uploaded. If you see hashes, those files were not allowed to be downloaded. " +
"Ask your paired friend to send you the mod in question through other means or acquire the mod yourself."),
ImGuiColors.DalamudGrey);
if (ImGui.BeginTable("TransfersTable", 2, ImGuiTableFlags.SizingStretchProp))
{
ImGui.TableSetupColumn(
$"Hash/Filename");
ImGui.TableSetupColumn($"Forbidden by");
ImGui.TableSetupColumn(L("Settings.Transfers.Blocked.Column.Hash", "Hash/Filename"));
ImGui.TableSetupColumn(L("Settings.Transfers.Blocked.Column.ForbiddenBy", "Forbidden by"));
ImGui.TableHeadersRow();
@@ -358,18 +358,19 @@ public class SettingsUi : WindowMediatorSubscriberBase
if (!showTransferBars) ImGui.EndDisabled();
ImGui.Separator();
_uiShared.BigText("Current Transfers");
_uiShared.BigText(L("Settings.Transfers.Current.Heading", "Current Transfers"));
if (ImGui.BeginTabBar("TransfersTabBar"))
{
if (ApiController.ServerState is ServerState.Connected && ImGui.BeginTabItem("Transfers"))
var currentTransfersTabTitle = L("Settings.Transfers.Current.Tab", "Transfers");
if (ApiController.ServerState is ServerState.Connected && ImGui.BeginTabItem(currentTransfersTabTitle + "###currentTransfersTab"))
{
ImGui.TextUnformatted("Uploads");
ImGui.TextUnformatted(L("Settings.Transfers.Current.Uploads", "Uploads"));
if (ImGui.BeginTable("UploadsTable", 3))
{
ImGui.TableSetupColumn("File");
ImGui.TableSetupColumn("Uploaded");
ImGui.TableSetupColumn("Size");
ImGui.TableSetupColumn(L("Settings.Transfers.Current.Uploads.Column.File", "File"));
ImGui.TableSetupColumn(L("Settings.Transfers.Current.Uploads.Column.Uploaded", "Uploaded"));
ImGui.TableSetupColumn(L("Settings.Transfers.Current.Uploads.Column.Size", "Size"));
ImGui.TableHeadersRow();
foreach (var transfer in _fileTransferManager.CurrentUploads.ToArray())
{
@@ -388,13 +389,13 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.EndTable();
}
ImGui.Separator();
ImGui.TextUnformatted("Downloads");
ImGui.TextUnformatted(L("Settings.Transfers.Current.Downloads", "Downloads"));
if (ImGui.BeginTable("DownloadsTable", 4))
{
ImGui.TableSetupColumn("User");
ImGui.TableSetupColumn("Server");
ImGui.TableSetupColumn("Files");
ImGui.TableSetupColumn("Download");
ImGui.TableSetupColumn(L("Settings.Transfers.Current.Downloads.Column.User", "User"));
ImGui.TableSetupColumn(L("Settings.Transfers.Current.Downloads.Column.Server", "Server"));
ImGui.TableSetupColumn(L("Settings.Transfers.Current.Downloads.Column.Files", "Files"));
ImGui.TableSetupColumn(L("Settings.Transfers.Current.Downloads.Column.Download", "Download"));
ImGui.TableHeadersRow();
foreach (var transfer in _currentDownloads.ToArray())
@@ -423,8 +424,8 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("Blocked Transfers"))
var blockedTransfersTabTitle = L("Settings.Transfers.Blocked.Tab", "Blocked Transfers");
if (ImGui.BeginTabItem(blockedTransfersTabTitle + "###blockedTransfersTab"))
{
DrawBlockedTransfers();
ImGui.EndTabItem();
@@ -634,53 +635,51 @@ public class SettingsUi : WindowMediatorSubscriberBase
{
_lastTab = "Advanced";
_uiShared.BigText("Advanced");
_uiShared.BigText(L("Settings.Advanced.Heading", "Advanced"));
bool mareApi = _configService.Current.MareAPI;
if (ImGui.Checkbox("Enable Umbra Sync API", ref mareApi))
if (ImGui.Checkbox(L("Settings.Advanced.Api.Enable", "Enable Umbra Sync API"), ref mareApi))
{
_configService.Current.MareAPI = mareApi;
_configService.Save();
_ipcProvider.HandleMareImpersonation();
}
_uiShared.DrawHelpText("Enables handling of the Umbra Sync API. This currently includes:\n\n" +
" - MCDF loading support for other plugins\n" +
" - Blocking Moodles applications to paired users\n\n" +
"If the Umbra Sync plugin is loaded while this option is enabled, control of its API will be relinquished.");
_uiShared.DrawHelpText(L("Settings.Advanced.Api.Description",
"Enables handling of the Umbra Sync API. This currently includes:\n\n - MCDF loading support for other plugins\n - Blocking Moodles applications to paired users\n\nIf the Umbra Sync plugin is loaded while this option is enabled, control of its API will be relinquished."));
using (_ = ImRaii.PushIndent())
{
ImGui.SameLine(300.0f * ImGuiHelpers.GlobalScale);
if (_ipcProvider.ImpersonationActive)
{
UiSharedService.ColorTextWrapped("Umbra API active!", UiSharedService.AccentColor);
UiSharedService.ColorTextWrapped(L("Settings.Advanced.Api.Status.Active", "Umbra API active!"), UiSharedService.AccentColor);
}
else
{
if (!mareApi)
UiSharedService.ColorTextWrapped("Umbra API inactive: Option is disabled", ImGuiColors.DalamudYellow);
UiSharedService.ColorTextWrapped(L("Settings.Advanced.Api.Status.Disabled", "Umbra API inactive: Option is disabled"), ImGuiColors.DalamudYellow);
else if (_ipcProvider.MarePluginEnabled)
UiSharedService.ColorTextWrapped("Umbra API inactive: Umbra plugin is loaded", ImGuiColors.DalamudYellow);
UiSharedService.ColorTextWrapped(L("Settings.Advanced.Api.Status.PluginLoaded", "Umbra API inactive: Umbra plugin is loaded"), ImGuiColors.DalamudYellow);
else
UiSharedService.ColorTextWrapped("Umbra API inactive: Unknown reason", ImGuiColors.DalamudRed);
UiSharedService.ColorTextWrapped(L("Settings.Advanced.Api.Status.Unknown", "Umbra API inactive: Unknown reason"), ImGuiColors.DalamudRed);
}
}
bool logEvents = _configService.Current.LogEvents;
if (ImGui.Checkbox("Log Event Viewer data to disk", ref logEvents))
if (ImGui.Checkbox(L("Settings.Advanced.EventViewer.LogToDisk", "Log Event Viewer data to disk"), ref logEvents))
{
_configService.Current.LogEvents = logEvents;
_configService.Save();
}
ImGui.SameLine(300.0f * ImGuiHelpers.GlobalScale);
if (_uiShared.IconTextButton(FontAwesomeIcon.NotesMedical, "Open Event Viewer"))
if (_uiShared.IconTextButton(FontAwesomeIcon.NotesMedical, L("Settings.Advanced.EventViewer.Open", "Open Event Viewer")))
{
Mediator.Publish(new UiToggleMessage(typeof(EventViewerUI)));
}
bool holdCombatApplication = _configService.Current.HoldCombatApplication;
if (ImGui.Checkbox("Hold application during combat", ref holdCombatApplication))
if (ImGui.Checkbox(L("Settings.Advanced.HoldCombat", "Hold application during combat"), ref holdCombatApplication))
{
if (!holdCombatApplication)
Mediator.Publish(new CombatOrPerformanceEndMessage());
@@ -689,17 +688,17 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
bool serializedApplications = _configService.Current.SerialApplication;
if (ImGui.Checkbox("Serialized player applications", ref serializedApplications))
if (ImGui.Checkbox(L("Settings.Advanced.SerializedApplications", "Serialized player applications"), ref serializedApplications))
{
_configService.Current.SerialApplication = serializedApplications;
_configService.Save();
}
_uiShared.DrawHelpText("Experimental - May reduce issues in crowded areas");
_uiShared.DrawHelpText(L("Settings.Advanced.SerializedApplications.Description", "Experimental - May reduce issues in crowded areas"));
ImGui.Separator();
_uiShared.BigText("Debug");
_uiShared.BigText(L("Settings.Advanced.DebugHeading", "Debug"));
#if DEBUG
if (LastCreatedCharacterData != null && ImGui.TreeNode("Last created character data"))
if (LastCreatedCharacterData != null && ImGui.TreeNode(L("Settings.Advanced.Debug.LastCreatedTree", "Last created character data")))
{
foreach (var l in JsonSerializer.Serialize(LastCreatedCharacterData, new JsonSerializerOptions() { WriteIndented = true }).Split('\n'))
{
@@ -709,7 +708,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.TreePop();
}
#endif
if (_uiShared.IconTextButton(FontAwesomeIcon.Copy, "[DEBUG] Copy Last created Character Data to clipboard"))
if (_uiShared.IconTextButton(FontAwesomeIcon.Copy, L("Settings.Advanced.Debug.CopyButton", "[DEBUG] Copy Last created Character Data to clipboard")))
{
if (LastCreatedCharacterData != null)
{
@@ -717,39 +716,39 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
else
{
ImGui.SetClipboardText("ERROR: No created character data, cannot copy.");
ImGui.SetClipboardText(L("Settings.Advanced.Debug.CopyError", "ERROR: No created character data, cannot copy."));
}
}
UiSharedService.AttachToolTip("Use this when reporting mods being rejected from the server.");
UiSharedService.AttachToolTip(L("Settings.Advanced.Debug.CopyTooltip", "Use this when reporting mods being rejected from the server."));
_uiShared.DrawCombo("Log Level", Enum.GetValues<LogLevel>(), (l) => l.ToString(), (l) =>
_uiShared.DrawCombo(L("Settings.Advanced.LogLevel", "Log Level"), Enum.GetValues<LogLevel>(), (l) => l.ToString(), (l) =>
{
_configService.Current.LogLevel = l;
_configService.Save();
}, _configService.Current.LogLevel);
bool logPerformance = _configService.Current.LogPerformance;
if (ImGui.Checkbox("Log Performance Counters", ref logPerformance))
if (ImGui.Checkbox(L("Settings.Advanced.Performance.LogCounters", "Log Performance Counters"), ref logPerformance))
{
_configService.Current.LogPerformance = logPerformance;
_configService.Save();
}
_uiShared.DrawHelpText("Enabling this can incur a (slight) performance impact. Enabling this for extended periods of time is not recommended.");
_uiShared.DrawHelpText(L("Settings.Advanced.Performance.LogCounters.Description", "Enabling this can incur a (slight) performance impact. Enabling this for extended periods of time is not recommended."));
using (ImRaii.Disabled(!logPerformance))
{
if (_uiShared.IconTextButton(FontAwesomeIcon.StickyNote, "Print Performance Stats to /xllog"))
if (_uiShared.IconTextButton(FontAwesomeIcon.StickyNote, L("Settings.Advanced.Performance.PrintStats", "Print Performance Stats to /xllog")))
{
_performanceCollector.PrintPerformanceStats();
}
ImGui.SameLine();
if (_uiShared.IconTextButton(FontAwesomeIcon.StickyNote, "Print Performance Stats (last 60s) to /xllog"))
if (_uiShared.IconTextButton(FontAwesomeIcon.StickyNote, L("Settings.Advanced.Performance.PrintStatsRecent", "Print Performance Stats (last 60s) to /xllog")))
{
_performanceCollector.PrintPerformanceStats(60);
}
}
if (ImGui.TreeNode("Active Character Blocks"))
if (ImGui.TreeNode(L("Settings.Advanced.ActiveBlocks", "Active Character Blocks")))
{
var onlinePairs = _pairManager.GetOnlineUserPairs();
foreach (var pair in onlinePairs)
@@ -782,10 +781,10 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.Separator();
_uiShared.BigText("Storage");
_uiShared.BigText(L("Settings.Storage.Heading", "Storage"));
UiSharedService.TextWrapped("Umbra stores downloaded files from paired people permanently. This is to improve loading performance and requiring less downloads. " +
"The storage governs itself by clearing data beyond the set storage size. Please set the storage size accordingly. It is not necessary to manually clear the storage.");
UiSharedService.TextWrapped(L("Settings.Storage.Description",
"Umbra stores downloaded files from paired people permanently. This is to improve loading performance and requiring less downloads. The storage governs itself by clearing data beyond the set storage size. Please set the storage size accordingly. It is not necessary to manually clear the storage."));
_uiShared.DrawFileScanState();
ImGui.AlignTextToFramePadding();
@@ -1563,29 +1562,32 @@ public class SettingsUi : WindowMediatorSubscriberBase
_lastTab = "Service Settings";
if (ApiController.ServerAlive)
{
_uiShared.BigText("Service Actions");
var serviceActionsHeading = L("Settings.Service.ActionsHeading", "Service Actions");
_uiShared.BigText(serviceActionsHeading);
ImGuiHelpers.ScaledDummy(new Vector2(5, 5));
if (ImGui.Button("Delete account"))
var deleteAccountLabel = L("Settings.Service.Actions.DeleteAccount", "Delete account");
var deleteAccountPopupTitle = L("Settings.Service.Actions.DeleteAccountPopup", "Delete your account?");
if (ImGui.Button(deleteAccountLabel))
{
_deleteAccountPopupModalShown = true;
ImGui.OpenPopup("Delete your account?");
ImGui.OpenPopup(deleteAccountPopupTitle);
}
_uiShared.DrawHelpText("Completely deletes your currently connected account.");
_uiShared.DrawHelpText(L("Settings.Service.Actions.DeleteAccount.Description", "Completely deletes your currently connected account."));
if (ImGui.BeginPopupModal("Delete your account?", ref _deleteAccountPopupModalShown, UiSharedService.PopupWindowFlags))
if (ImGui.BeginPopupModal(deleteAccountPopupTitle, ref _deleteAccountPopupModalShown, UiSharedService.PopupWindowFlags))
{
UiSharedService.TextWrapped(
"Your account and all associated files and data on the service will be deleted.");
UiSharedService.TextWrapped("Your UID will be removed from all pairing lists.");
ImGui.TextUnformatted("Are you sure you want to continue?");
L("Settings.Service.Actions.DeleteAccount.Popup.Body1", "Your account and all associated files and data on the service will be deleted."));
UiSharedService.TextWrapped(L("Settings.Service.Actions.DeleteAccount.Popup.Body2", "Your UID will be removed from all pairing lists."));
ImGui.TextUnformatted(L("Settings.Service.Actions.DeleteAccount.Popup.Confirm", "Are you sure you want to continue?"));
ImGui.Separator();
ImGui.Spacing();
var buttonSize = (ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X -
ImGui.GetStyle().ItemSpacing.X) / 2;
if (ImGui.Button("Delete account", new Vector2(buttonSize, 0)))
var deleteAccountConfirmLabel = deleteAccountLabel + "###deleteAccountConfirm";
if (ImGui.Button(deleteAccountConfirmLabel, new Vector2(buttonSize, 0)))
{
_ = Task.Run(ApiController.UserDelete);
_deleteAccountPopupModalShown = false;
@@ -1594,7 +1596,8 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.SameLine();
if (ImGui.Button("Cancel##cancelDelete", new Vector2(buttonSize, 0)))
var cancelDeleteLabel = L("Settings.Service.Actions.DeleteAccount.Popup.Cancel", "Cancel") + "##cancelDelete";
if (ImGui.Button(cancelDeleteLabel, new Vector2(buttonSize, 0)))
{
_deleteAccountPopupModalShown = false;
}
@@ -1605,7 +1608,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.Separator();
}
_uiShared.BigText("Service & Character Settings");
_uiShared.BigText(L("Settings.Service.SettingsHeading", "Service & Character Settings"));
var idx = _uiShared.DrawServiceSelection();
var playerName = _dalamudUtilService.GetPlayerName();
@@ -1619,12 +1622,16 @@ public class SettingsUi : WindowMediatorSubscriberBase
if (selectedServer == _serverConfigurationManager.CurrentServer)
{
if (_apiController.IsConnected)
UiSharedService.ColorTextWrapped("For any changes to be applied to the current service you need to reconnect to the service.", ImGuiColors.DalamudYellow);
UiSharedService.ColorTextWrapped(L("Settings.Service.ReconnectWarning", "For any changes to be applied to the current service you need to reconnect to the service."), ImGuiColors.DalamudYellow);
}
var characterAssignmentsTab = L("Settings.Service.Tabs.CharacterAssignments", "Character Assignments");
var secretKeyManagementTab = L("Settings.Service.Tabs.SecretKey", "Secret Key Management");
var serviceSettingsTab = L("Settings.Service.Tabs.ServiceSettings", "Service Settings");
if (ImGui.BeginTabBar("serverTabBar"))
{
if (ImGui.BeginTabItem("Character Assignments"))
if (ImGui.BeginTabItem(characterAssignmentsTab))
{
if (selectedServer.SecretKeys.Count > 0)
{
@@ -1638,7 +1645,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
using (_ = _uiShared.IconFont.Push())
iconWidth = ImGui.CalcTextSize(FontAwesomeIcon.Trash.ToIconString()).X;
UiSharedService.ColorTextWrapped("Characters listed here will connect with the specified secret key.", ImGuiColors.DalamudYellow);
UiSharedService.ColorTextWrapped(L("Settings.Service.Character.Assignments.Description", "Characters listed here will connect with the specified secret key."), ImGuiColors.DalamudYellow);
int i = 0;
foreach (var item in selectedServer.Authentications.ToList())
{
@@ -1653,7 +1660,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_uiShared.IconText(thisIsYou ? FontAwesomeIcon.Star : FontAwesomeIcon.None);
if (thisIsYou)
UiSharedService.AttachToolTip("Current character");
UiSharedService.AttachToolTip(L("Settings.Service.Character.Assignments.TooltipCurrent", "Current character"));
ImGui.SameLine(windowPadding + iconWidth + itemSpacing);
float beforeName = ImGui.GetCursorPosX();
@@ -1693,7 +1700,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
if (_uiShared.IconButton(FontAwesomeIcon.Trash))
_serverConfigurationManager.RemoveCharacterFromServer(idx, item);
UiSharedService.AttachToolTip("Delete character assignment");
UiSharedService.AttachToolTip(L("Settings.Service.Character.Assignments.DeleteTooltip", "Delete character assignment"));
i++;
}
@@ -1704,7 +1711,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
&& c.WorldId == _uiShared.WorldId
)))
{
if (_uiShared.IconTextButton(FontAwesomeIcon.User, "Add current character"))
if (_uiShared.IconTextButton(FontAwesomeIcon.User, L("Settings.Service.Character.Assignments.AddCurrent", "Add current character")))
{
_serverConfigurationManager.AddCurrentCharacterToServer(idx);
}
@@ -1713,19 +1720,19 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
else
{
UiSharedService.ColorTextWrapped("You need to add a Secret Key first before adding Characters.", ImGuiColors.DalamudYellow);
UiSharedService.ColorTextWrapped(L("Settings.Service.Character.Assignments.NoKeys", "You need to add a Secret Key first before adding Characters."), ImGuiColors.DalamudYellow);
}
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("Secret Key Management"))
if (ImGui.BeginTabItem(secretKeyManagementTab))
{
foreach (var item in selectedServer.SecretKeys.ToList())
{
using var id = ImRaii.PushId("key" + item.Key);
var friendlyName = item.Value.FriendlyName;
if (ImGui.InputText("Secret Key Display Name", ref friendlyName, 255))
if (ImGui.InputText(L("Settings.Service.SecretKey.DisplayName", "Secret Key Display Name"), ref friendlyName, 255))
{
item.Value.FriendlyName = friendlyName;
_serverConfigurationManager.Save();
@@ -1733,7 +1740,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
var key = item.Value.Key;
var keyInUse = selectedServer.Authentications.Exists(p => p.SecretKeyIdx == item.Key);
if (keyInUse) ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudGrey3);
if (ImGui.InputText("Secret Key", ref key, 64, keyInUse ? ImGuiInputTextFlags.ReadOnly : default))
if (ImGui.InputText(L("Settings.Service.SecretKey.Value", "Secret Key"), ref key, 64, keyInUse ? ImGuiInputTextFlags.ReadOnly : default))
{
item.Value.Key = key;
_serverConfigurationManager.Save();
@@ -1750,7 +1757,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
using (_ = ImRaii.Disabled(disableAssignment))
{
if (_uiShared.IconTextButton(FontAwesomeIcon.User, "Assign current character"))
if (_uiShared.IconTextButton(FontAwesomeIcon.User, L("Settings.Service.SecretKey.AssignCurrent", "Assign current character")))
{
var currentAssignment = selectedServer.Authentications.Find(a =>
string.Equals(a.CharacterName, _uiShared.PlayerName, StringComparison.OrdinalIgnoreCase)
@@ -1772,22 +1779,22 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
}
if (!disableAssignment)
UiSharedService.AttachToolTip($"Use this secret key for {playerName} @ {playerWorldName}");
UiSharedService.AttachToolTip(L("Settings.Service.SecretKey.AssignTooltip", "Use this secret key for {0} @ {1}", playerName, playerWorldName));
}
ImGui.SameLine();
using var disableDelete = ImRaii.Disabled(keyInUse);
if (_uiShared.IconTextButton(FontAwesomeIcon.Trash, "Delete Secret Key") && UiSharedService.CtrlPressed())
if (_uiShared.IconTextButton(FontAwesomeIcon.Trash, L("Settings.Service.SecretKey.Delete", "Delete Secret Key")) && UiSharedService.CtrlPressed())
{
selectedServer.SecretKeys.Remove(item.Key);
_serverConfigurationManager.Save();
}
if (!keyInUse)
UiSharedService.AttachToolTip("Hold CTRL to delete this secret key entry");
UiSharedService.AttachToolTip(L("Settings.Service.SecretKey.DeleteTooltip", "Hold CTRL to delete this secret key entry"));
if (keyInUse)
{
UiSharedService.ColorTextWrapped("This key is currently assigned to a character and cannot be edited or deleted.", ImGuiColors.DalamudYellow);
UiSharedService.ColorTextWrapped(L("Settings.Service.SecretKey.InUse", "This key is currently assigned to a character and cannot be edited or deleted."), ImGuiColors.DalamudYellow);
}
if (item.Key != selectedServer.SecretKeys.Keys.LastOrDefault())
@@ -1795,11 +1802,11 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
ImGui.Separator();
if (_uiShared.IconTextButton(FontAwesomeIcon.Plus, "Add new Secret Key"))
if (_uiShared.IconTextButton(FontAwesomeIcon.Plus, L("Settings.Service.SecretKey.Add", "Add new Secret Key")))
{
selectedServer.SecretKeys.Add(selectedServer.SecretKeys.Any() ? selectedServer.SecretKeys.Max(p => p.Key) + 1 : 0, new SecretKey()
{
FriendlyName = "New Secret Key",
FriendlyName = L("Settings.Service.SecretKey.NewFriendlyName", "New Secret Key"),
});
_serverConfigurationManager.Save();
}
@@ -1807,7 +1814,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
if (true) // Enable registration button for all servers
{
ImGui.SameLine();
if (_uiShared.IconTextButton(FontAwesomeIcon.Plus, "Register a new Umbra account"))
if (_uiShared.IconTextButton(FontAwesomeIcon.Plus, L("Settings.Service.SecretKey.RegisterAccount", "Register a new Umbra account")))
{
_registrationInProgress = true;
_ = Task.Run(async () => {
@@ -1819,14 +1826,14 @@ public class SettingsUi : WindowMediatorSubscriberBase
_logger.LogWarning("Registration failed: {err}", reply.ErrorMessage);
_registrationMessage = reply.ErrorMessage;
if (_registrationMessage.IsNullOrEmpty())
_registrationMessage = "An unknown error occured. Please try again later.";
_registrationMessage = L("Settings.Service.SecretKey.RegisterFailed", "An unknown error occured. Please try again later.");
return;
}
_registrationMessage = "New account registered.\nPlease keep a copy of your secret key in case you need to reset your plugins, or to use it on another PC.";
_registrationMessage = L("Settings.Service.SecretKey.RegisterSuccess", "New account registered.\nPlease keep a copy of your secret key in case you need to reset your plugins, or to use it on another PC.");
_registrationSuccess = true;
selectedServer.SecretKeys.Add(selectedServer.SecretKeys.Any() ? selectedServer.SecretKeys.Max(p => p.Key) + 1 : 0, new SecretKey()
{
FriendlyName = reply.UID + $" (registered {DateTime.Now:yyyy-MM-dd})",
FriendlyName = L("Settings.Service.SecretKey.RegisteredFriendlyName", "{0} (registered {1})", reply.UID, DateTime.Now.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)),
Key = reply.SecretKey ?? ""
});
_serverConfigurationManager.Save();
@@ -1835,7 +1842,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
{
_logger.LogWarning(ex, "Registration failed");
_registrationSuccess = false;
_registrationMessage = "An unknown error occured. Please try again later.";
_registrationMessage = L("Settings.Service.SecretKey.RegisterFailed", "An unknown error occured. Please try again later.");
}
finally
{
@@ -1845,7 +1852,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
if (_registrationInProgress)
{
ImGui.TextUnformatted("Sending request...");
ImGui.TextUnformatted(L("Settings.Service.SecretKey.Registering", "Sending request..."));
}
else if (!_registrationMessage.IsNullOrEmpty())
{
@@ -1859,39 +1866,39 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("Service Settings"))
if (ImGui.BeginTabItem(serviceSettingsTab + "###serviceSettingsInnerTab"))
{
var serverName = selectedServer.ServerName;
var serverUri = selectedServer.ServerUri;
var isMain = string.Equals(serverName, ApiController.UmbraServer, StringComparison.OrdinalIgnoreCase);
var flags = isMain ? ImGuiInputTextFlags.ReadOnly : ImGuiInputTextFlags.None;
if (ImGui.InputText("Service URI", ref serverUri, 255, flags))
if (ImGui.InputText(L("Settings.Service.ServiceTab.Uri", "Service URI"), ref serverUri, 255, flags))
{
selectedServer.ServerUri = serverUri;
}
if (isMain)
{
_uiShared.DrawHelpText("You cannot edit the URI of the main service.");
_uiShared.DrawHelpText(L("Settings.Service.ServiceTab.UriReadOnlyHint", "You cannot edit the URI of the main service."));
}
if (ImGui.InputText("Service Name", ref serverName, 255, flags))
if (ImGui.InputText(L("Settings.Service.ServiceTab.Name", "Service Name"), ref serverName, 255, flags))
{
selectedServer.ServerName = serverName;
_serverConfigurationManager.Save();
}
if (isMain)
{
_uiShared.DrawHelpText("You cannot edit the name of the main service.");
_uiShared.DrawHelpText(L("Settings.Service.ServiceTab.NameReadOnlyHint", "You cannot edit the name of the main service."));
}
if (!isMain && selectedServer != _serverConfigurationManager.CurrentServer)
{
if (_uiShared.IconTextButton(FontAwesomeIcon.Trash, "Delete Service") && UiSharedService.CtrlPressed())
if (_uiShared.IconTextButton(FontAwesomeIcon.Trash, L("Settings.Service.ServiceTab.Delete", "Delete Service")) && UiSharedService.CtrlPressed())
{
_serverConfigurationManager.DeleteServer(selectedServer);
}
_uiShared.DrawHelpText("Hold CTRL to delete this service");
_uiShared.DrawHelpText(L("Settings.Service.ServiceTab.DeleteHint", "Hold CTRL to delete this service"));
}
ImGui.EndTabItem();
}
@@ -1942,13 +1949,15 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("Transfers"))
var transfersTabLabel = L("Settings.Transfers.Current.Tab", "Transfers");
if (ImGui.BeginTabItem(transfersTabLabel + "###mainTransfersTab"))
{
DrawCurrentTransfers();
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("Service Settings"))
var serviceSettingsTabLabel = L("Settings.Service.Tabs.ServiceSettings", "Service Settings");
if (ImGui.BeginTabItem(serviceSettingsTabLabel + "###mainServiceSettingsTab"))
{
ImGui.BeginDisabled(_registrationInProgress);
DrawServerConfiguration();
@@ -1956,7 +1965,8 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.EndDisabled();
}
if (ImGui.BeginTabItem("Advanced"))
var advancedTabLabel = L("Settings.Advanced.Tab", "Advanced");
if (ImGui.BeginTabItem(advancedTabLabel + "###advancedTab"))
{
DrawAdvanced();
ImGui.EndTabItem();