From 6744c6676c436423beb0526f8b6af4e3b6213e1e Mon Sep 17 00:00:00 2001 From: Infi Date: Tue, 20 Jan 2026 11:27:37 +0100 Subject: [PATCH] - Add missing auto translates for the symbols --- ChatTwo/ChatTwo.csproj | 2 +- ChatTwo/Ui/ChatLogWindow.cs | 2 +- ChatTwo/Ui/SeStringDebugger.cs | 1 + ChatTwo/Util/AutoTranslate.cs | 46 +++++++++++++++++++++------------- 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/ChatTwo/ChatTwo.csproj b/ChatTwo/ChatTwo.csproj index ffb2f73..33520b9 100755 --- a/ChatTwo/ChatTwo.csproj +++ b/ChatTwo/ChatTwo.csproj @@ -1,6 +1,6 @@ - 1.34.0 + 1.34.1 enable enable true diff --git a/ChatTwo/Ui/ChatLogWindow.cs b/ChatTwo/Ui/ChatLogWindow.cs index 2d3ed43..b54c695 100644 --- a/ChatTwo/Ui/ChatLogWindow.cs +++ b/ChatTwo/Ui/ChatLogWindow.cs @@ -1486,7 +1486,7 @@ public sealed class ChatLogWindow : Window var entry = AutoCompleteList[i]; var highlight = AutoCompleteSelection == i; - var clicked = ImGui.Selectable($"{entry.String}##{entry.Group}/{entry.Row}", highlight) || selected == i; + var clicked = ImGui.Selectable($"{entry.Text}##{entry.Group}/{entry.Row}", highlight) || selected == i; if (i < 10) { var button = (i + 1) % 10; diff --git a/ChatTwo/Ui/SeStringDebugger.cs b/ChatTwo/Ui/SeStringDebugger.cs index 1d02e53..167b3b9 100644 --- a/ChatTwo/Ui/SeStringDebugger.cs +++ b/ChatTwo/Ui/SeStringDebugger.cs @@ -155,6 +155,7 @@ public class SeStringDebugger : Window RenderMetadataDictionary("Link AutoTranslatePayload", new Dictionary { { "Text", at.Text }, + { "Key/Group", $"{at.Key}/{at.Group}" }, { "Data", string.Join(" ", at.Encode().Select(b => b.ToString("X2"))) }, }); break; diff --git a/ChatTwo/Util/AutoTranslate.cs b/ChatTwo/Util/AutoTranslate.cs index c42c045..7b8ce7b 100644 --- a/ChatTwo/Util/AutoTranslate.cs +++ b/ChatTwo/Util/AutoTranslate.cs @@ -144,11 +144,9 @@ internal static class AutoTranslate foreach (var col in columns) { var rawName = rowParser.ReadStringColumn(col); - var name = rawName.ToDalamudString(); - var text = name.TextValue; - if (text.Length > 0) + if (!rawName.IsEmpty) { - list.Add(new AutoTranslateEntry(row.Group, (uint)i, text, name)); + list.Add(new AutoTranslateEntry(row.Group, (uint)i, rawName.ToString(), string.Empty)); if (shouldAdd) ValidEntries.Add((row.Group, (uint)i)); @@ -159,8 +157,7 @@ internal static class AutoTranslate } else if (lookup is not "@") { - var text = row.Text.ToDalamudString(); - list.Add(new AutoTranslateEntry(row.Group, row.RowId, text.TextValue, text)); + list.Add(new AutoTranslateEntry(row.Group, row.RowId, row.Text.ToString(), row.GroupTitle.ToString())); if (shouldAdd) ValidEntries.Add((row.Group, row.RowId)); @@ -183,19 +180,34 @@ internal static class AutoTranslate var otherMatches = new List(); foreach (var entry in AllEntries()) { - if (entry.String.Equals(prefix, StringComparison.OrdinalIgnoreCase)) + if (entry.Text.Equals(prefix, StringComparison.OrdinalIgnoreCase)) + { wholeMatches.Add(entry); - else if (entry.String.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) + } + else if (entry.Text.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) + { prefixMatches.Add(entry); - else if (entry.String.Contains(prefix, StringComparison.OrdinalIgnoreCase)) + } + else if (entry.Text.Contains(prefix, StringComparison.OrdinalIgnoreCase)) + { otherMatches.Add(entry); + } + else if (entry.Title.Length > 0) + { + if (entry.Title.Equals(prefix, StringComparison.OrdinalIgnoreCase)) + wholeMatches.Add(entry); + else if (entry.Title.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) + prefixMatches.Add(entry); + else if (entry.Title.Contains(prefix, StringComparison.OrdinalIgnoreCase)) + otherMatches.Add(entry); + } } if (sort) { - return wholeMatches.OrderBy(entry => entry.String, StringComparer.OrdinalIgnoreCase) - .Concat(prefixMatches.OrderBy(entry => entry.String, StringComparer.OrdinalIgnoreCase)) - .Concat(otherMatches.OrderBy(entry => entry.String, StringComparer.OrdinalIgnoreCase)) + return wholeMatches.OrderBy(entry => entry.Text, StringComparer.OrdinalIgnoreCase) + .Concat(prefixMatches.OrderBy(entry => entry.Text, StringComparer.OrdinalIgnoreCase)) + .Concat(otherMatches.OrderBy(entry => entry.Text, StringComparer.OrdinalIgnoreCase)) .ToList(); } @@ -293,14 +305,14 @@ internal class AutoTranslateEntry { internal uint Group { get; } internal uint Row { get; } - internal string String { get; } - internal SeString SeString { get; } + internal string Text { get; } + internal string Title { get; } - public AutoTranslateEntry(uint group, uint row, string str, SeString seStr) + public AutoTranslateEntry(uint group, uint row, string str, string title) { Group = group; Row = row; - String = str; - SeString = seStr; + Text = str; + Title = title; } }