From 3521c9460e435b25755fbea184c18ca6fd9963ee Mon Sep 17 00:00:00 2001 From: Anna Clemens Date: Sat, 5 Feb 2022 19:54:57 -0500 Subject: [PATCH] fix: update some things for localisation --- ChatTwo/Code/ChatTypeExt.cs | 2 +- ChatTwo/Resources/Language.Designer.cs | 9 +++++++++ ChatTwo/Resources/Language.resx | 3 +++ ChatTwo/Ui/ChatLog.cs | 6 ++++-- ChatTwo/Ui/Settings.cs | 3 ++- ChatTwo/Ui/SettingsTabs/Tabs.cs | 2 +- 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ChatTwo/Code/ChatTypeExt.cs b/ChatTwo/Code/ChatTypeExt.cs index 29e4dec..92a1ea9 100755 --- a/ChatTwo/Code/ChatTypeExt.cs +++ b/ChatTwo/Code/ChatTypeExt.cs @@ -4,7 +4,7 @@ using ChatTwo.Util; namespace ChatTwo.Code; internal static class ChatTypeExt { - internal static readonly (string, ChatType[])[] SortOrder = { + internal static IEnumerable<(string, ChatType[])> SortOrder => new[] { (Language.Options_Tabs_ChannelTypes_Special, new[] { ChatType.Debug, ChatType.Urgent, diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs index 0596099..a1680b9 100755 --- a/ChatTwo/Resources/Language.Designer.cs +++ b/ChatTwo/Resources/Language.Designer.cs @@ -78,6 +78,15 @@ namespace ChatTwo.Resources { } } + /// + /// Looks up a localized string similar to Delete tab. + /// + internal static string ChatLog_Tabs_Delete { + get { + return ResourceManager.GetString("ChatLog_Tabs_Delete", resourceCulture); + } + } + /// /// Looks up a localized string similar to Move down. /// diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx index 3c1f6ff..06305be 100755 --- a/ChatTwo/Resources/Language.resx +++ b/ChatTwo/Resources/Language.resx @@ -350,4 +350,7 @@ The font size to use for game symbols. + + Delete tab + diff --git a/ChatTwo/Ui/ChatLog.cs b/ChatTwo/Ui/ChatLog.cs index fa95ef6..db64f66 100755 --- a/ChatTwo/Ui/ChatLog.cs +++ b/ChatTwo/Ui/ChatLog.cs @@ -313,7 +313,9 @@ internal sealed class ChatLog : IUiComponent { ImGui.SetNextWindowBgAlpha(this.Ui.Plugin.Config.WindowAlpha); } - if (!ImGui.Begin($"{this.Ui.Plugin.Name}##chat", flags)) { + ImGui.SetNextWindowSize(new Vector2(500, 250) * ImGuiHelpers.GlobalScale, ImGuiCond.FirstUseEver); + + if (!ImGui.Begin($"{this.Ui.Plugin.Name}###chat2", flags)) { this._lastViewport = ImGui.GetWindowViewport().NativePtr; ImGui.End(); return; @@ -747,7 +749,7 @@ internal sealed class ChatLog : IUiComponent { anyChanged = true; } - if (ImGuiUtil.IconButton(FontAwesomeIcon.TrashAlt, tooltip: "Delete tab")) { + if (ImGuiUtil.IconButton(FontAwesomeIcon.TrashAlt, tooltip: Language.ChatLog_Tabs_Delete)) { tabs.RemoveAt(i); anyChanged = true; } diff --git a/ChatTwo/Ui/Settings.cs b/ChatTwo/Ui/Settings.cs index 463de6e..50ad488 100755 --- a/ChatTwo/Ui/Settings.cs +++ b/ChatTwo/Ui/Settings.cs @@ -50,7 +50,8 @@ internal sealed class Settings : IUiComponent { ImGui.SetNextWindowSize(new Vector2(500, 650) * ImGuiHelpers.GlobalScale, ImGuiCond.FirstUseEver); - if (!ImGui.Begin(string.Format(Language.Settings_Title, this.Ui.Plugin.Name), ref this.Ui.SettingsVisible)) { + var name = string.Format(Language.Settings_Title, this.Ui.Plugin.Name); + if (!ImGui.Begin($"{name}###chat2-settings", ref this.Ui.SettingsVisible)) { ImGui.End(); return; } diff --git a/ChatTwo/Ui/SettingsTabs/Tabs.cs b/ChatTwo/Ui/SettingsTabs/Tabs.cs index f111e95..73b238f 100755 --- a/ChatTwo/Ui/SettingsTabs/Tabs.cs +++ b/ChatTwo/Ui/SettingsTabs/Tabs.cs @@ -46,7 +46,7 @@ internal sealed class Tabs : ISettingsTab { ImGui.InputText(Language.Options_Tabs_Name, ref tab.Name, 512, ImGuiInputTextFlags.EnterReturnsTrue); ImGui.Checkbox(Language.Options_Tabs_ShowTimestamps, ref tab.DisplayTimestamp); - if (ImGui.BeginCombo(Language.Options_Tabs_UnreadMode, tab.UnreadMode.ToString())) { + if (ImGui.BeginCombo(Language.Options_Tabs_UnreadMode, tab.UnreadMode.Name())) { foreach (var mode in Enum.GetValues()) { if (ImGui.Selectable(mode.Name(), tab.UnreadMode == mode)) { tab.UnreadMode = mode;