Translate phase 1

This commit is contained in:
2025-09-21 17:01:12 +02:00
parent 0808266887
commit 6d8a8476b4
30 changed files with 2763 additions and 749 deletions

View File

@@ -35,7 +35,7 @@ public class EditProfileUi : WindowMediatorSubscriberBase
ApiController apiController, UiSharedService uiSharedService, FileDialogManager fileDialogManager,
ServerConfigurationManager serverConfigurationManager,
MareProfileManager mareProfileManager, PerformanceCollectorService performanceCollectorService)
: base(logger, mediator, "Umbra Edit Profile###UmbraSyncEditProfileUI", performanceCollectorService)
: base(logger, mediator, uiSharedService.Localize("EditProfile.WindowTitle", "Umbra Edit Profile") + "###UmbraSyncEditProfileUI", performanceCollectorService)
{
IsOpen = false;
this.SizeConstraints = new()
@@ -62,9 +62,11 @@ public class EditProfileUi : WindowMediatorSubscriberBase
});
}
private string L(string key, string fallback, params object[] args) => _uiSharedService.Localize(key, fallback, args);
protected override void DrawInternal()
{
_uiSharedService.BigText("Current Profile (as saved on server)");
_uiSharedService.BigText(L("EditProfile.CurrentProfile", "Current Profile (as saved on server)"));
var profile = _mareProfileManager.GetMareProfile(new UserData(_apiController.UID));
@@ -125,9 +127,9 @@ public class EditProfileUi : WindowMediatorSubscriberBase
ImGui.Separator();
_uiSharedService.BigText("Profile Settings");
if (_uiSharedService.IconTextButton(FontAwesomeIcon.FileUpload, "Upload new profile picture"))
if (_uiSharedService.IconTextButton(FontAwesomeIcon.FileUpload, L("EditProfile.Button.UploadPicture", "Upload new profile picture")))
{
_fileDialogManager.OpenFileDialog("Select new Profile picture", ".png", (success, file) =>
_fileDialogManager.OpenFileDialog(L("EditProfile.Dialog.PictureTitle", "Select new Profile picture"), ".png", (success, file) =>
{
if (!success) return;
_ = Task.Run(async () =>
@@ -148,29 +150,29 @@ public class EditProfileUi : WindowMediatorSubscriberBase
});
});
}
UiSharedService.AttachToolTip("Select and upload a new profile picture");
UiSharedService.AttachToolTip(L("EditProfile.Tooltip.UploadPicture", "Select and upload a new profile picture"));
ImGui.SameLine();
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Clear uploaded profile picture"))
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, L("EditProfile.Button.ClearPicture", "Clear uploaded profile picture")))
{
_ = _apiController.UserSetProfile(new UserProfileDto(new UserData(_apiController.UID), Disabled: false, IsNSFW: null, "", Description: null));
}
UiSharedService.AttachToolTip("Clear your currently uploaded profile picture");
UiSharedService.AttachToolTip(L("EditProfile.Tooltip.ClearPicture", "Clear your currently uploaded profile picture"));
if (_showFileDialogError)
{
UiSharedService.ColorTextWrapped("The profile picture must be a PNG file with a maximum height and width of 256px and 250KiB size", ImGuiColors.DalamudRed);
UiSharedService.ColorTextWrapped(L("EditProfile.Error.PictureTooLarge", "The profile picture must be a PNG file with a maximum height and width of 256px and 250KiB size"), ImGuiColors.DalamudRed);
}
var isNsfw = profile.IsNSFW;
if (ImGui.Checkbox("Profile is NSFW", ref isNsfw))
if (ImGui.Checkbox(L("EditProfile.Checkbox.Nsfw", "Profile is NSFW"), ref isNsfw))
{
_ = _apiController.UserSetProfile(new UserProfileDto(new UserData(_apiController.UID), Disabled: false, isNsfw, ProfilePictureBase64: null, Description: null));
}
_uiSharedService.DrawHelpText("If your profile description or image can be considered NSFW, toggle this to ON");
_uiSharedService.DrawHelpText(L("EditProfile.Help.Nsfw", "If your profile description or image can be considered NSFW, toggle this to ON"));
var widthTextBox = 400;
var posX = ImGui.GetCursorPosX();
ImGui.TextUnformatted($"Description {_descriptionText.Length}/1500");
ImGui.TextUnformatted(L("EditProfile.DescriptionCounter", "Description {0}/1500", _descriptionText.Length));
ImGui.SetCursorPosX(posX);
ImGuiHelpers.ScaledRelativeSameLine(widthTextBox, ImGui.GetStyle().ItemSpacing.X);
ImGui.TextUnformatted("Preview (approximate)");
ImGui.TextUnformatted(L("EditProfile.PreviewLabel", "Preview (approximate)"));
using (_uiSharedService.GameFont.Push())
ImGui.InputTextMultiline("##description", ref _descriptionText, 1500, ImGuiHelpers.ScaledVector2(widthTextBox, 200));
@@ -199,17 +201,17 @@ public class EditProfileUi : WindowMediatorSubscriberBase
ImGui.EndChildFrame();
}
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Save, "Save Description"))
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Save, L("EditProfile.Button.SaveDescription", "Save Description")))
{
_ = _apiController.UserSetProfile(new UserProfileDto(new UserData(_apiController.UID), Disabled: false, IsNSFW: null, ProfilePictureBase64: null, _descriptionText));
}
UiSharedService.AttachToolTip("Sets your profile description text");
UiSharedService.AttachToolTip(L("EditProfile.Tooltip.SaveDescription", "Sets your profile description text"));
ImGui.SameLine();
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Clear Description"))
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, L("EditProfile.Button.ClearDescription", "Clear Description")))
{
_ = _apiController.UserSetProfile(new UserProfileDto(new UserData(_apiController.UID), Disabled: false, IsNSFW: null, ProfilePictureBase64: null, ""));
}
UiSharedService.AttachToolTip("Clears your profile description text");
UiSharedService.AttachToolTip(L("EditProfile.Tooltip.ClearDescription", "Clears your profile description text"));
}
protected override void Dispose(bool disposing)
@@ -217,4 +219,4 @@ public class EditProfileUi : WindowMediatorSubscriberBase
base.Dispose(disposing);
_pfpTextureWrap?.Dispose();
}
}
}