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

@@ -17,6 +17,7 @@ using MareSynchronos.Services.ServerConfiguration;
using MareSynchronos.UI.Components;
using MareSynchronos.UI.Handlers;
using MareSynchronos.WebAPI;
using MareSynchronos.Localization;
using System;
using System.Globalization;
using System.Numerics;
@@ -72,6 +73,13 @@ internal sealed class GroupPanel
private string _syncShellPassword = string.Empty;
private string _syncShellToJoin = string.Empty;
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 GroupPanel(CompactUi mainUi, UiSharedService uiShared, PairManager pairManager, ChatService chatServivce,
UidDisplayHandler uidDisplayHandler, MareConfigService mareConfig, ServerConfigurationManager serverConfigurationManager,
CharaDataManager charaDataManager)
@@ -99,13 +107,15 @@ internal sealed class GroupPanel
{
var buttonSize = _uiShared.GetIconButtonSize(FontAwesomeIcon.Plus);
ImGui.SetNextItemWidth(UiSharedService.GetWindowContentRegionWidth() - ImGui.GetWindowContentRegionMin().X - buttonSize.X);
ImGui.InputTextWithHint("##syncshellid", "Syncshell GID/Alias (leave empty to create)", ref _syncShellToJoin, 50);
ImGui.InputTextWithHint("##syncshellid", L("GroupPanel.Join.InputHint", "Syncshell GID/Alias (leave empty to create)"), ref _syncShellToJoin, 50);
ImGui.SameLine(ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth() - buttonSize.X);
bool userCanJoinMoreGroups = _pairManager.GroupPairs.Count < ApiController.ServerInfo.MaxGroupsJoinedByUser;
bool userCanCreateMoreGroups = _pairManager.GroupPairs.Count(u => string.Equals(u.Key.Owner.UID, ApiController.UID, StringComparison.Ordinal)) < ApiController.ServerInfo.MaxGroupsCreatedByUser;
bool alreadyInGroup = _pairManager.GroupPairs.Select(p => p.Key).Any(p => string.Equals(p.Group.Alias, _syncShellToJoin, StringComparison.Ordinal)
|| string.Equals(p.Group.GID, _syncShellToJoin, StringComparison.Ordinal));
var enterPasswordPopupTitle = L("GroupPanel.Join.PasswordPopup", "Enter Syncshell Password");
var createPopupTitle = L("GroupPanel.Create.PopupTitle", "Create Syncshell");
if (alreadyInGroup) ImGui.BeginDisabled();
if (_uiShared.IconButton(FontAwesomeIcon.Plus))
@@ -116,7 +126,7 @@ internal sealed class GroupPanel
{
_errorGroupJoin = false;
_showModalEnterPassword = true;
ImGui.OpenPopup("Enter Syncshell Password");
ImGui.OpenPopup(enterPasswordPopupTitle);
}
}
else
@@ -130,30 +140,37 @@ internal sealed class GroupPanel
_tempSyncshellDurationHours = 24;
_errorGroupCreateMessage = string.Empty;
_showModalCreateGroup = true;
ImGui.OpenPopup("Create Syncshell");
ImGui.OpenPopup(createPopupTitle);
}
}
}
UiSharedService.AttachToolTip(_syncShellToJoin.IsNullOrEmpty()
? (userCanCreateMoreGroups ? "Create Syncshell" : $"You cannot create more than {ApiController.ServerInfo.MaxGroupsCreatedByUser} Syncshells")
: (userCanJoinMoreGroups ? "Join Syncshell" + _syncShellToJoin : $"You cannot join more than {ApiController.ServerInfo.MaxGroupsJoinedByUser} Syncshells"));
? (userCanCreateMoreGroups
? L("GroupPanel.Create.Tooltip", "Create Syncshell")
: L("GroupPanel.Create.TooMany", "You cannot create more than {0} Syncshells", ApiController.ServerInfo.MaxGroupsCreatedByUser))
: (userCanJoinMoreGroups
? L("GroupPanel.Join.Tooltip", "Join Syncshell {0}", _syncShellToJoin)
: L("GroupPanel.Join.TooMany", "You cannot join more than {0} Syncshells", ApiController.ServerInfo.MaxGroupsJoinedByUser)));
if (alreadyInGroup) ImGui.EndDisabled();
if (ImGui.BeginPopupModal("Enter Syncshell Password", ref _showModalEnterPassword, UiSharedService.PopupWindowFlags))
if (ImGui.BeginPopupModal(enterPasswordPopupTitle, ref _showModalEnterPassword, UiSharedService.PopupWindowFlags))
{
UiSharedService.TextWrapped("Before joining any Syncshells please be aware that you will be automatically paired with everyone in the Syncshell.");
UiSharedService.TextWrapped(L("GroupPanel.Join.Warning", "Before joining any Syncshells please be aware that you will be automatically paired with everyone in the Syncshell."));
ImGui.Separator();
UiSharedService.TextWrapped("Enter the password for Syncshell " + _syncShellToJoin + ":");
UiSharedService.TextWrapped(L("GroupPanel.Join.EnterPassword", "Enter the password for Syncshell {0}:", _syncShellToJoin));
ImGui.SetNextItemWidth(-1);
ImGui.InputTextWithHint("##password", _syncShellToJoin + " Password", ref _syncShellPassword, 255, ImGuiInputTextFlags.Password);
ImGui.InputTextWithHint("##password", L("GroupPanel.Join.PasswordHint", "{0} Password", _syncShellToJoin), ref _syncShellPassword, 255, ImGuiInputTextFlags.Password);
if (_errorGroupJoin)
{
UiSharedService.ColorTextWrapped($"An error occured during joining of this Syncshell: you either have joined the maximum amount of Syncshells ({ApiController.ServerInfo.MaxGroupsJoinedByUser}), " +
$"it does not exist, the password you entered is wrong, you already joined the Syncshell, the Syncshell is full ({ApiController.ServerInfo.MaxGroupUserCount} users) or the Syncshell has closed invites.",
UiSharedService.ColorTextWrapped(
L("GroupPanel.Join.Error",
"An error occured during joining of this Syncshell: you either have joined the maximum amount of Syncshells ({0}), it does not exist, the password you entered is wrong, you already joined the Syncshell, the Syncshell is full ({1} users) or the Syncshell has closed invites.",
ApiController.ServerInfo.MaxGroupsJoinedByUser,
ApiController.ServerInfo.MaxGroupUserCount),
new Vector4(1, 0, 0, 1));
}
if (ImGui.Button("Join " + _syncShellToJoin))
if (ImGui.Button(L("GroupPanel.Join.Button", "Join {0}", _syncShellToJoin)))
{
var shell = _syncShellToJoin;
var pw = _syncShellPassword;
@@ -169,69 +186,70 @@ internal sealed class GroupPanel
ImGui.EndPopup();
}
if (ImGui.BeginPopupModal("Create Syncshell", ref _showModalCreateGroup, UiSharedService.PopupWindowFlags))
if (ImGui.BeginPopupModal(createPopupTitle, ref _showModalCreateGroup, UiSharedService.PopupWindowFlags))
{
UiSharedService.TextWrapped("Choisissez le type de Syncshell à créer.");
UiSharedService.TextWrapped(L("GroupPanel.Create.ChooseType", "Choisissez le type de Syncshell à créer."));
bool showPermanent = !_createIsTemporary;
if (ImGui.RadioButton("Permanente", showPermanent))
if (ImGui.RadioButton(L("GroupPanel.Create.Permanent", "Permanente"), showPermanent))
{
_createIsTemporary = false;
}
ImGui.SameLine();
if (ImGui.RadioButton("Temporaire", _createIsTemporary))
if (ImGui.RadioButton(L("GroupPanel.Create.Temporary", "Temporaire"), _createIsTemporary))
{
_createIsTemporary = true;
_newSyncShellAlias = string.Empty;
}
if (!_createIsTemporary)
{
UiSharedService.TextWrapped("Donnez un nom à votre Syncshell (optionnel) puis créez-la.");
ImGui.SetNextItemWidth(-1);
ImGui.InputTextWithHint("##syncshellalias", "Nom du Syncshell", ref _newSyncShellAlias, 50);
}
else
{
_newSyncShellAlias = string.Empty;
}
if (_createIsTemporary)
{
UiSharedService.TextWrapped("Durée maximale d'une Syncshell temporaire : 7 jours.");
if (_tempSyncshellDurationHours > 168) _tempSyncshellDurationHours = 168;
for (int i = 0; i < _temporaryDurationOptions.Length; i++)
{
var option = _temporaryDurationOptions[i];
var isSelected = _tempSyncshellDurationHours == option;
string label = option switch
{
>= 24 when option % 24 == 0 => option == 24 ? "24h" : $"{option / 24}j",
_ => option + "h"
};
if (ImGui.RadioButton(label, isSelected))
{
_tempSyncshellDurationHours = option;
}
// Start a new line after every 3 buttons
if ((i + 1) % 3 == 0)
{
ImGui.NewLine();
}
else
{
ImGui.SameLine();
}
}
var expiresLocal = DateTime.Now.AddHours(_tempSyncshellDurationHours);
UiSharedService.TextWrapped($"Expiration le {expiresLocal:g} (heure locale).");
}
if (!_createIsTemporary)
{
UiSharedService.TextWrapped(L("GroupPanel.Create.AliasPrompt", "Donnez un nom à votre Syncshell (optionnel) puis créez-la."));
ImGui.SetNextItemWidth(-1);
ImGui.InputTextWithHint("##syncshellalias", L("GroupPanel.Create.AliasHint", "Nom du Syncshell"), ref _newSyncShellAlias, 50);
}
else
{
_newSyncShellAlias = string.Empty;
}
UiSharedService.TextWrapped("Appuyez sur le bouton ci-dessous pour créer une nouvelle Syncshell.");
if (_createIsTemporary)
{
UiSharedService.TextWrapped(L("GroupPanel.Create.TempMaxDuration", "Durée maximale d'une Syncshell temporaire : 7 jours."));
if (_tempSyncshellDurationHours > 168) _tempSyncshellDurationHours = 168;
for (int i = 0; i < _temporaryDurationOptions.Length; i++)
{
var option = _temporaryDurationOptions[i];
var isSelected = _tempSyncshellDurationHours == option;
string label = option switch
{
>= 24 when option % 24 == 0 => option == 24
? L("GroupPanel.Create.Duration.SingleDay", "24h")
: L("GroupPanel.Create.Duration.Days", "{0}j", option / 24),
_ => L("GroupPanel.Create.Duration.Hours", "{0}h", option)
};
if (ImGui.RadioButton(label, isSelected))
{
_tempSyncshellDurationHours = option;
}
if ((i + 1) % 3 == 0)
{
ImGui.NewLine();
}
else
{
ImGui.SameLine();
}
}
var expiresLocal = DateTime.Now.AddHours(_tempSyncshellDurationHours);
UiSharedService.TextWrapped(L("GroupPanel.Create.TempExpires", "Expiration le {0:g} (heure locale).", expiresLocal));
}
UiSharedService.TextWrapped(L("GroupPanel.Create.Instruction", "Appuyez sur le bouton ci-dessous pour créer une nouvelle Syncshell."));
ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale);
if (ImGui.Button("Create Syncshell"))
if (ImGui.Button(L("GroupPanel.Create.Button", "Create Syncshell")))
{
try
{
@@ -256,7 +274,7 @@ internal sealed class GroupPanel
_errorGroupCreate = true;
if (ex.Message.Contains("name is already in use", StringComparison.OrdinalIgnoreCase))
{
_errorGroupCreateMessage = "Le nom de la Syncshell est déjà utilisé.";
_errorGroupCreateMessage = L("GroupPanel.Create.Error.NameInUse", "Le nom de la Syncshell est déjà utilisé.");
}
else
{
@@ -272,28 +290,28 @@ internal sealed class GroupPanel
_errorGroupCreateMessage = string.Empty;
if (!string.IsNullOrWhiteSpace(_lastCreatedGroup.Group.Alias))
{
ImGui.TextUnformatted("Syncshell Name: " + _lastCreatedGroup.Group.Alias);
ImGui.TextUnformatted(L("GroupPanel.Create.Result.Name", "Syncshell Name: {0}", _lastCreatedGroup.Group.Alias));
}
ImGui.TextUnformatted("Syncshell ID: " + _lastCreatedGroup.Group.GID);
ImGui.TextUnformatted(L("GroupPanel.Create.Result.Id", "Syncshell ID: {0}", _lastCreatedGroup.Group.GID));
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted("Syncshell Password: " + _lastCreatedGroup.Password);
ImGui.TextUnformatted(L("GroupPanel.Create.Result.Password", "Syncshell Password: {0}", _lastCreatedGroup.Password));
ImGui.SameLine();
if (_uiShared.IconButton(FontAwesomeIcon.Copy))
{
ImGui.SetClipboardText(_lastCreatedGroup.Password);
}
UiSharedService.TextWrapped("You can change the Syncshell password later at any time.");
UiSharedService.TextWrapped(L("GroupPanel.Create.Result.ChangeLater", "You can change the Syncshell password later at any time."));
if (_lastCreatedGroup.IsTemporary && _lastCreatedGroup.ExpiresAt != null)
{
var expiresLocal = _lastCreatedGroup.ExpiresAt.Value.ToLocalTime();
UiSharedService.TextWrapped($"Cette Syncshell expirera le {expiresLocal:g} (heure locale).");
UiSharedService.TextWrapped(L("GroupPanel.Create.Result.TempExpires", "Cette Syncshell expirera le {0:g} (heure locale).", expiresLocal));
}
}
if (_errorGroupCreate)
{
var msg = string.IsNullOrWhiteSpace(_errorGroupCreateMessage)
? "You are already owner of the maximum amount of Syncshells (3) or joined the maximum amount of Syncshells (6). Relinquish ownership of your own Syncshells to someone else or leave existing Syncshells."
? L("GroupPanel.Create.Error.Generic", "You are already owner of the maximum amount of Syncshells (3) or joined the maximum amount of Syncshells (6). Relinquish ownership of your own Syncshells to someone else or leave existing Syncshells.")
: _errorGroupCreateMessage;
UiSharedService.ColorTextWrapped(msg, new Vector4(1, 0, 0, 1));
}
@@ -332,7 +350,7 @@ internal sealed class GroupPanel
ImGui.PushFont(UiBuilder.IconFont);
ImGui.TextUnformatted(FontAwesomeIcon.Crown.ToIconString());
ImGui.PopFont();
UiSharedService.AttachToolTip("You are the owner of Syncshell " + groupName);
UiSharedService.AttachToolTip(L("GroupPanel.Syncshell.OwnerTooltip", "You are the owner of Syncshell {0}", groupName));
ImGui.SameLine();
}
else if (groupDto.GroupUserInfo.IsModerator())
@@ -340,7 +358,7 @@ internal sealed class GroupPanel
ImGui.PushFont(UiBuilder.IconFont);
ImGui.TextUnformatted(FontAwesomeIcon.UserShield.ToIconString());
ImGui.PopFont();
UiSharedService.AttachToolTip("You are a moderator of Syncshell " + groupName);
UiSharedService.AttachToolTip(L("GroupPanel.Syncshell.ModeratorTooltip", "You are a moderator of Syncshell {0}", groupName));
ImGui.SameLine();
}
@@ -358,29 +376,33 @@ internal sealed class GroupPanel
var totalMembers = pairsInGroup.Count + 1;
var connectedMembers = pairsInGroup.Count(p => p.IsOnline) + 1;
var maxCapacity = ApiController.ServerInfo.MaxGroupUserCount;
ImGui.TextUnformatted($"{connectedMembers}/{totalMembers}");
UiSharedService.AttachToolTip("Membres connectés / membres totaux" + Environment.NewLine +
$"Capacité maximale : {maxCapacity}" + Environment.NewLine +
"Syncshell ID: " + groupDto.Group.GID);
ImGui.TextUnformatted(L("GroupPanel.Syncshell.MemberCount", "{0}/{1}", connectedMembers, totalMembers));
UiSharedService.AttachToolTip(
L("GroupPanel.Syncshell.MemberCountTooltip",
"Membres connectés / membres totaux\nCapacité maximale : {0}\nSyncshell ID: {1}",
maxCapacity,
groupDto.Group.GID));
if (textIsGid) ImGui.PushFont(UiBuilder.MonoFont);
ImGui.SameLine();
ImGui.TextUnformatted(groupName);
if (textIsGid) ImGui.PopFont();
UiSharedService.AttachToolTip("Left click to switch between GID display and comment" + Environment.NewLine +
"Right click to change comment for " + groupName + Environment.NewLine + Environment.NewLine
+ "Users: " + (pairsInGroup.Count + 1) + ", Owner: " + groupDto.OwnerAliasOrUID);
UiSharedService.AttachToolTip(L("GroupPanel.Syncshell.NameTooltip",
"Left click to switch between GID display and comment\nRight click to change comment for {0}\n\nUsers: {1}, Owner: {2}",
groupName,
pairsInGroup.Count + 1,
groupDto.OwnerAliasOrUID));
if (groupDto.IsTemporary)
{
ImGui.SameLine();
UiSharedService.ColorText("(Temp)", ImGuiColors.DalamudOrange);
UiSharedService.ColorText(L("GroupPanel.Syncshell.TempTag", "(Temp)"), ImGuiColors.DalamudOrange);
if (groupDto.ExpiresAt != null)
{
var tempExpireLocal = groupDto.ExpiresAt.Value.ToLocalTime();
UiSharedService.AttachToolTip($"Expire le {tempExpireLocal:g}");
UiSharedService.AttachToolTip(L("GroupPanel.Syncshell.TempExpires", "Expire le {0:g}", tempExpireLocal));
}
else
{
UiSharedService.AttachToolTip("Syncshell temporaire");
UiSharedService.AttachToolTip(L("GroupPanel.Syncshell.TempTooltip", "Syncshell temporaire"));
}
}
if (ImGui.IsItemClicked(ImGuiMouseButton.Left))
@@ -406,7 +428,7 @@ internal sealed class GroupPanel
{
var buttonSizes = _uiShared.GetIconButtonSize(FontAwesomeIcon.Bars).X + _uiShared.GetIconButtonSize(FontAwesomeIcon.LockOpen).X;
ImGui.SetNextItemWidth(UiSharedService.GetWindowContentRegionWidth() - ImGui.GetCursorPosX() - buttonSizes - ImGui.GetStyle().ItemSpacing.X * 2);
if (ImGui.InputTextWithHint("", "Comment/Notes", ref _editGroupComment, 255, ImGuiInputTextFlags.EnterReturnsTrue))
if (ImGui.InputTextWithHint("", L("GroupPanel.CommentHint", "Comment/Notes"), ref _editGroupComment, 255, ImGuiInputTextFlags.EnterReturnsTrue))
{
_serverConfigurationManager.SetNoteForGid(groupDto.GID, _editGroupComment);
_editGroupEntry = string.Empty;
@@ -417,7 +439,7 @@ internal sealed class GroupPanel
{
_editGroupEntry = string.Empty;
}
UiSharedService.AttachToolTip("Hit ENTER to save\nRight click to cancel");
UiSharedService.AttachToolTip(L("GroupPanel.CommentTooltip", "Hit ENTER to save\nRight click to cancel"));
}
@@ -426,26 +448,26 @@ internal sealed class GroupPanel
if (_showModalBanList && !_modalBanListOpened)
{
_modalBanListOpened = true;
ImGui.OpenPopup("Manage Banlist for " + groupDto.GID);
ImGui.OpenPopup(L("GroupPanel.Banlist.Title", "Manage Banlist for {0}", groupDto.GID));
}
if (!_showModalBanList) _modalBanListOpened = false;
if (ImGui.BeginPopupModal("Manage Banlist for " + groupDto.GID, ref _showModalBanList, UiSharedService.PopupWindowFlags))
if (ImGui.BeginPopupModal(L("GroupPanel.Banlist.Title", "Manage Banlist for {0}", groupDto.GID), ref _showModalBanList, UiSharedService.PopupWindowFlags))
{
if (_uiShared.IconTextButton(FontAwesomeIcon.Retweet, "Refresh Banlist from Server"))
if (_uiShared.IconTextButton(FontAwesomeIcon.Retweet, L("GroupPanel.Banlist.Refresh", "Refresh Banlist from Server")))
{
_bannedUsers = ApiController.GroupGetBannedUsers(groupDto).Result;
}
if (ImGui.BeginTable("bannedusertable" + groupDto.GID, 6, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingStretchProp | ImGuiTableFlags.ScrollY))
{
ImGui.TableSetupColumn("UID", ImGuiTableColumnFlags.None, 1);
ImGui.TableSetupColumn("Alias", ImGuiTableColumnFlags.None, 1);
ImGui.TableSetupColumn("By", ImGuiTableColumnFlags.None, 1);
ImGui.TableSetupColumn("Date", ImGuiTableColumnFlags.None, 2);
ImGui.TableSetupColumn("Reason", ImGuiTableColumnFlags.None, 3);
ImGui.TableSetupColumn("Actions", ImGuiTableColumnFlags.None, 1);
ImGui.TableSetupColumn(L("GroupPanel.Banlist.Column.Uid", "UID"), ImGuiTableColumnFlags.None, 1);
ImGui.TableSetupColumn(L("GroupPanel.Banlist.Column.Alias", "Alias"), ImGuiTableColumnFlags.None, 1);
ImGui.TableSetupColumn(L("GroupPanel.Banlist.Column.By", "By"), ImGuiTableColumnFlags.None, 1);
ImGui.TableSetupColumn(L("GroupPanel.Banlist.Column.Date", "Date"), ImGuiTableColumnFlags.None, 2);
ImGui.TableSetupColumn(L("GroupPanel.Banlist.Column.Reason", "Reason"), ImGuiTableColumnFlags.None, 3);
ImGui.TableSetupColumn(L("GroupPanel.Banlist.Column.Actions", "Actions"), ImGuiTableColumnFlags.None, 1);
ImGui.TableHeadersRow();
@@ -462,7 +484,7 @@ internal sealed class GroupPanel
ImGui.TableNextColumn();
UiSharedService.TextWrapped(bannedUser.Reason);
ImGui.TableNextColumn();
if (_uiShared.IconTextButton(FontAwesomeIcon.Check, "Unban#" + bannedUser.UID))
if (_uiShared.IconTextButton(FontAwesomeIcon.Check, L("GroupPanel.Banlist.Unban", "Unban") + "#" + bannedUser.UID))
{
_ = ApiController.GroupUnbanUser(bannedUser);
_bannedUsers.RemoveAll(b => string.Equals(b.UID, bannedUser.UID, StringComparison.Ordinal));
@@ -478,18 +500,18 @@ internal sealed class GroupPanel
if (_showModalChangePassword && !_modalChangePwOpened)
{
_modalChangePwOpened = true;
ImGui.OpenPopup("Change Syncshell Password");
ImGui.OpenPopup(L("GroupPanel.Password.Title", "Change Syncshell Password"));
}
if (!_showModalChangePassword) _modalChangePwOpened = false;
if (ImGui.BeginPopupModal("Change Syncshell Password", ref _showModalChangePassword, UiSharedService.PopupWindowFlags))
if (ImGui.BeginPopupModal(L("GroupPanel.Password.Title", "Change Syncshell Password"), ref _showModalChangePassword, UiSharedService.PopupWindowFlags))
{
UiSharedService.TextWrapped("Enter the new Syncshell password for Syncshell " + name + " here.");
UiSharedService.TextWrapped("This action is irreversible");
UiSharedService.TextWrapped(L("GroupPanel.Password.Description", "Enter the new Syncshell password for Syncshell {0} here.", name));
UiSharedService.TextWrapped(L("GroupPanel.Password.Warning", "This action is irreversible"));
ImGui.SetNextItemWidth(-1);
ImGui.InputTextWithHint("##changepw", "New password for " + name, ref _newSyncShellPassword, 255);
if (ImGui.Button("Change password"))
ImGui.InputTextWithHint("##changepw", L("GroupPanel.Password.Hint", "New password for {0}", name), ref _newSyncShellPassword, 255);
if (ImGui.Button(L("GroupPanel.Password.Button", "Change password")))
{
var pw = _newSyncShellPassword;
_isPasswordValid = ApiController.GroupChangePassword(new(groupDto.Group, pw)).Result;
@@ -499,7 +521,7 @@ internal sealed class GroupPanel
if (!_isPasswordValid)
{
UiSharedService.ColorTextWrapped("The selected password is too short. It must be at least 10 characters.", new Vector4(1, 0, 0, 1));
UiSharedService.ColorTextWrapped(L("GroupPanel.Password.Error.TooShort", "The selected password is too short. It must be at least 10 characters."), new Vector4(1, 0, 0, 1));
}
UiSharedService.SetScaledWindowSize(290);
@@ -509,29 +531,28 @@ internal sealed class GroupPanel
if (_showModalBulkOneTimeInvites && !_modalBulkOneTimeInvitesOpened)
{
_modalBulkOneTimeInvitesOpened = true;
ImGui.OpenPopup("Create Bulk One-Time Invites");
ImGui.OpenPopup(L("GroupPanel.Invites.Title", "Create Bulk One-Time Invites"));
}
if (!_showModalBulkOneTimeInvites) _modalBulkOneTimeInvitesOpened = false;
if (ImGui.BeginPopupModal("Create Bulk One-Time Invites", ref _showModalBulkOneTimeInvites, UiSharedService.PopupWindowFlags))
if (ImGui.BeginPopupModal(L("GroupPanel.Invites.Title", "Create Bulk One-Time Invites"), ref _showModalBulkOneTimeInvites, UiSharedService.PopupWindowFlags))
{
UiSharedService.TextWrapped("This allows you to create up to 100 one-time invites at once for the Syncshell " + name + "." + Environment.NewLine
+ "The invites are valid for 24h after creation and will automatically expire.");
UiSharedService.TextWrapped(L("GroupPanel.Invites.Description", "This allows you to create up to 100 one-time invites at once for the Syncshell {0}.\nThe invites are valid for 24h after creation and will automatically expire.", name));
ImGui.Separator();
if (_bulkOneTimeInvites.Count == 0)
{
ImGui.SetNextItemWidth(-1);
ImGui.SliderInt("Amount##bulkinvites", ref _bulkInviteCount, 1, 100);
if (_uiShared.IconTextButton(FontAwesomeIcon.MailBulk, "Create invites"))
ImGui.SliderInt(L("GroupPanel.Invites.AmountLabel", "Amount") + "##bulkinvites", ref _bulkInviteCount, 1, 100);
if (_uiShared.IconTextButton(FontAwesomeIcon.MailBulk, L("GroupPanel.Invites.CreateButton", "Create invites")))
{
_bulkOneTimeInvites = ApiController.GroupCreateTempInvite(groupDto, _bulkInviteCount).Result;
}
}
else
{
UiSharedService.TextWrapped("A total of " + _bulkOneTimeInvites.Count + " invites have been created.");
if (_uiShared.IconTextButton(FontAwesomeIcon.Copy, "Copy invites to clipboard"))
UiSharedService.TextWrapped(L("GroupPanel.Invites.Result", "A total of {0} invites have been created.", _bulkOneTimeInvites.Count));
if (_uiShared.IconTextButton(FontAwesomeIcon.Copy, L("GroupPanel.Invites.Copy", "Copy invites to clipboard")))
{
ImGui.SetClipboardText(string.Join(Environment.NewLine, _bulkOneTimeInvites));
}
@@ -578,14 +599,14 @@ internal sealed class GroupPanel
if (visibleUsers.Count > 0)
{
ImGui.TextUnformatted("Visible");
ImGui.TextUnformatted(L("GroupPanel.List.Visible", "Visible"));
ImGui.Separator();
_uidDisplayHandler.RenderPairList(visibleUsers);
}
if (onlineUsers.Count > 0)
{
ImGui.TextUnformatted("Online");
ImGui.TextUnformatted(L("GroupPanel.List.Online", "Online"));
ImGui.Separator();
_uidDisplayHandler.RenderPairList(onlineUsers);
}
@@ -593,12 +614,12 @@ internal sealed class GroupPanel
if (offlineUsers.Count > 0)
{
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudGrey);
ImGui.TextUnformatted("Offline/Unknown");
ImGui.TextUnformatted(L("GroupPanel.List.Offline", "Offline/Unknown"));
ImGui.PopStyleColor();
ImGui.Separator();
if (hideOfflineUsers)
{
UiSharedService.ColorText($" {offlineUsers.Count} offline users omitted from display.", ImGuiColors.DalamudGrey);
UiSharedService.ColorText(L("GroupPanel.List.OfflineOmitted", " {0} offline users omitted from display.", offlineUsers.Count), ImGuiColors.DalamudGrey);
}
else
{
@@ -653,11 +674,11 @@ internal sealed class GroupPanel
ImGui.BeginTooltip();
if (!invitesEnabled || soundsDisabled || animDisabled || vfxDisabled)
{
ImGui.TextUnformatted("Syncshell permissions");
ImGui.TextUnformatted(L("GroupPanel.Permissions.Header", "Syncshell permissions"));
if (!invitesEnabled)
{
var lockedText = "Syncshell is closed for joining";
var lockedText = L("GroupPanel.Permissions.InvitesDisabled", "Syncshell is closed for joining");
_uiShared.IconText(lockedIcon);
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
ImGui.TextUnformatted(lockedText);
@@ -665,7 +686,7 @@ internal sealed class GroupPanel
if (soundsDisabled)
{
var soundsText = "Sound sync disabled through owner";
var soundsText = L("GroupPanel.Permissions.SoundDisabledOwner", "Sound sync disabled through owner");
_uiShared.IconText(soundsIcon);
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
ImGui.TextUnformatted(soundsText);
@@ -673,7 +694,7 @@ internal sealed class GroupPanel
if (animDisabled)
{
var animText = "Animation sync disabled through owner";
var animText = L("GroupPanel.Permissions.AnimationDisabledOwner", "Animation sync disabled through owner");
_uiShared.IconText(animIcon);
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
ImGui.TextUnformatted(animText);
@@ -681,7 +702,7 @@ internal sealed class GroupPanel
if (vfxDisabled)
{
var vfxText = "VFX sync disabled through owner";
var vfxText = L("GroupPanel.Permissions.VfxDisabledOwner", "VFX sync disabled through owner");
_uiShared.IconText(vfxIcon);
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
ImGui.TextUnformatted(vfxText);
@@ -693,11 +714,11 @@ internal sealed class GroupPanel
if (!invitesEnabled || soundsDisabled || animDisabled || vfxDisabled)
ImGui.Separator();
ImGui.TextUnformatted("Your permissions");
ImGui.TextUnformatted(L("GroupPanel.Permissions.OwnHeader", "Your permissions"));
if (userSoundsDisabled)
{
var userSoundsText = "Sound sync disabled through you";
var userSoundsText = L("GroupPanel.Permissions.SoundDisabledSelf", "Sound sync disabled through you");
_uiShared.IconText(userSoundsIcon);
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
ImGui.TextUnformatted(userSoundsText);
@@ -705,7 +726,7 @@ internal sealed class GroupPanel
if (userAnimDisabled)
{
var userAnimText = "Animation sync disabled through you";
var userAnimText = L("GroupPanel.Permissions.AnimationDisabledSelf", "Animation sync disabled through you");
_uiShared.IconText(userAnimIcon);
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
ImGui.TextUnformatted(userAnimText);
@@ -713,14 +734,14 @@ internal sealed class GroupPanel
if (userVFXDisabled)
{
var userVFXText = "VFX sync disabled through you";
var userVFXText = L("GroupPanel.Permissions.VfxDisabledSelf", "VFX sync disabled through you");
_uiShared.IconText(userVFXIcon);
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
ImGui.TextUnformatted(userVFXText);
}
if (!invitesEnabled || soundsDisabled || animDisabled || vfxDisabled)
UiSharedService.TextWrapped("Note that syncshell permissions for disabling take precedence over your own set permissions");
UiSharedService.TextWrapped(L("GroupPanel.Permissions.NotePriority", "Note that syncshell permissions for disabling take precedence over your own set permissions"));
}
ImGui.EndTooltip();
}
@@ -732,7 +753,8 @@ internal sealed class GroupPanel
var userPerm = groupDto.GroupUserPermissions ^ GroupUserPermissions.Paused;
_ = ApiController.GroupChangeIndividualPermissionState(new GroupPairUserPermissionDto(groupDto.Group, new UserData(ApiController.UID), userPerm));
}
UiSharedService.AttachToolTip((groupDto.GroupUserPermissions.IsPaused() ? "Resume" : "Pause") + " pairing with all users in this Syncshell");
UiSharedService.AttachToolTip(L("GroupPanel.PauseToggle.Tooltip", "{0} pairing with all users in this Syncshell",
groupDto.GroupUserPermissions.IsPaused() ? L("GroupPanel.PauseToggle.Resume", "Resume") : L("GroupPanel.PauseToggle.Pause", "Pause")));
ImGui.SameLine();
if (_uiShared.IconButton(FontAwesomeIcon.Bars))
@@ -742,28 +764,32 @@ internal sealed class GroupPanel
if (ImGui.BeginPopup("ShellPopup"))
{
if (_uiShared.IconTextButton(FontAwesomeIcon.ArrowCircleLeft, "Leave Syncshell") && UiSharedService.CtrlPressed())
if (_uiShared.IconTextButton(FontAwesomeIcon.ArrowCircleLeft, L("GroupPanel.Popup.Leave", "Leave Syncshell")) && UiSharedService.CtrlPressed())
{
_ = ApiController.GroupLeave(groupDto);
}
UiSharedService.AttachToolTip("Hold CTRL and click to leave this Syncshell" + (!string.Equals(groupDto.OwnerUID, ApiController.UID, StringComparison.Ordinal) ? string.Empty : Environment.NewLine
+ "WARNING: This action is irreversible" + Environment.NewLine + "Leaving an owned Syncshell will transfer the ownership to a random person in the Syncshell."));
UiSharedService.AttachToolTip(L("GroupPanel.Popup.LeaveTooltip", "Hold CTRL and click to leave this Syncshell{0}",
!string.Equals(groupDto.OwnerUID, ApiController.UID, StringComparison.Ordinal)
? string.Empty
: Environment.NewLine + L("GroupPanel.Popup.LeaveWarning", "WARNING: This action is irreversible\nLeaving an owned Syncshell will transfer the ownership to a random person in the Syncshell.")));
if (_uiShared.IconTextButton(FontAwesomeIcon.Copy, "Copy ID"))
if (_uiShared.IconTextButton(FontAwesomeIcon.Copy, L("GroupPanel.Popup.CopyId", "Copy ID")))
{
ImGui.CloseCurrentPopup();
ImGui.SetClipboardText(groupDto.GroupAliasOrGID);
}
UiSharedService.AttachToolTip("Copy Syncshell ID to Clipboard");
UiSharedService.AttachToolTip(L("GroupPanel.Popup.CopyIdTooltip", "Copy Syncshell ID to Clipboard"));
if (_uiShared.IconTextButton(FontAwesomeIcon.StickyNote, "Copy Notes"))
if (_uiShared.IconTextButton(FontAwesomeIcon.StickyNote, L("GroupPanel.Popup.CopyNotes", "Copy Notes")))
{
ImGui.CloseCurrentPopup();
ImGui.SetClipboardText(UiSharedService.GetNotes(groupPairs));
}
UiSharedService.AttachToolTip("Copies all your notes for all users in this Syncshell to the clipboard." + Environment.NewLine + "They can be imported via Settings -> General -> Notes -> Import notes from clipboard");
UiSharedService.AttachToolTip(L("GroupPanel.Popup.CopyNotesTooltip", "Copies all your notes for all users in this Syncshell to the clipboard.\nThey can be imported via Settings -> General -> Notes -> Import notes from clipboard"));
var soundsText = userSoundsDisabled ? "Enable sound sync" : "Disable sound sync";
var soundsText = userSoundsDisabled
? L("GroupPanel.Popup.EnableSound", "Enable sound sync")
: L("GroupPanel.Popup.DisableSound", "Disable sound sync");
if (_uiShared.IconTextButton(userSoundsIcon, soundsText))
{
ImGui.CloseCurrentPopup();
@@ -771,12 +797,11 @@ internal sealed class GroupPanel
perm.SetDisableSounds(!perm.IsDisableSounds());
_ = ApiController.GroupChangeIndividualPermissionState(new(groupDto.Group, new UserData(ApiController.UID), perm));
}
UiSharedService.AttachToolTip("Sets your allowance for sound synchronization for users of this syncshell."
+ Environment.NewLine + "Disabling the synchronization will stop applying sound modifications for users of this syncshell."
+ Environment.NewLine + "Note: this setting can be forcefully overridden to 'disabled' through the syncshell owner."
+ Environment.NewLine + "Note: this setting does not apply to individual pairs that are also in the syncshell.");
UiSharedService.AttachToolTip(L("GroupPanel.Popup.SoundTooltip", "Sets your allowance for sound synchronization for users of this syncshell.\nDisabling the synchronization will stop applying sound modifications for users of this syncshell.\nNote: this setting can be forcefully overridden to 'disabled' through the syncshell owner.\nNote: this setting does not apply to individual pairs that are also in the syncshell."));
var animText = userAnimDisabled ? "Enable animations sync" : "Disable animations sync";
var animText = userAnimDisabled
? L("GroupPanel.Popup.EnableAnimations", "Enable animations sync")
: L("GroupPanel.Popup.DisableAnimations", "Disable animations sync");
if (_uiShared.IconTextButton(userAnimIcon, animText))
{
ImGui.CloseCurrentPopup();
@@ -784,13 +809,11 @@ internal sealed class GroupPanel
perm.SetDisableAnimations(!perm.IsDisableAnimations());
_ = ApiController.GroupChangeIndividualPermissionState(new(groupDto.Group, new UserData(ApiController.UID), perm));
}
UiSharedService.AttachToolTip("Sets your allowance for animations synchronization for users of this syncshell."
+ Environment.NewLine + "Disabling the synchronization will stop applying animations modifications for users of this syncshell."
+ Environment.NewLine + "Note: this setting might also affect sound synchronization"
+ Environment.NewLine + "Note: this setting can be forcefully overridden to 'disabled' through the syncshell owner."
+ Environment.NewLine + "Note: this setting does not apply to individual pairs that are also in the syncshell.");
UiSharedService.AttachToolTip(L("GroupPanel.Popup.AnimTooltip", "Sets your allowance for animations synchronization for users of this syncshell.\nDisabling the synchronization will stop applying animations modifications for users of this syncshell.\nNote: this setting might also affect sound synchronization\nNote: this setting can be forcefully overridden to 'disabled' through the syncshell owner.\nNote: this setting does not apply to individual pairs that are also in the syncshell."));
var vfxText = userVFXDisabled ? "Enable VFX sync" : "Disable VFX sync";
var vfxText = userVFXDisabled
? L("GroupPanel.Popup.EnableVfx", "Enable VFX sync")
: L("GroupPanel.Popup.DisableVfx", "Disable VFX sync");
if (_uiShared.IconTextButton(userVFXIcon, vfxText))
{
ImGui.CloseCurrentPopup();
@@ -798,16 +821,12 @@ internal sealed class GroupPanel
perm.SetDisableVFX(!perm.IsDisableVFX());
_ = ApiController.GroupChangeIndividualPermissionState(new(groupDto.Group, new UserData(ApiController.UID), perm));
}
UiSharedService.AttachToolTip("Sets your allowance for VFX synchronization for users of this syncshell."
+ Environment.NewLine + "Disabling the synchronization will stop applying VFX modifications for users of this syncshell."
+ Environment.NewLine + "Note: this setting might also affect animation synchronization to some degree"
+ Environment.NewLine + "Note: this setting can be forcefully overridden to 'disabled' through the syncshell owner."
+ Environment.NewLine + "Note: this setting does not apply to individual pairs that are also in the syncshell.");
UiSharedService.AttachToolTip(L("GroupPanel.Popup.VfxTooltip", "Sets your allowance for VFX synchronization for users of this syncshell.\nDisabling the synchronization will stop applying VFX modifications for users of this syncshell.\nNote: this setting might also affect animation synchronization to some degree\nNote: this setting can be forcefully overridden to 'disabled' through the syncshell owner.\nNote: this setting does not apply to individual pairs that are also in the syncshell."));
if (isOwner || groupDto.GroupUserInfo.IsModerator())
{
ImGui.Separator();
if (_uiShared.IconTextButton(FontAwesomeIcon.Cog, "Open Admin Panel"))
if (_uiShared.IconTextButton(FontAwesomeIcon.Cog, L("GroupPanel.Popup.OpenAdmin", "Open Admin Panel")))
{
ImGui.CloseCurrentPopup();
_mainUi.Mediator.Publish(new OpenSyncshellAdminPanel(groupDto));