diff --git a/NewHorizons/Builder/Props/DialogueBuilder.cs b/NewHorizons/Builder/Props/DialogueBuilder.cs index f917c973..7d1beb0c 100644 --- a/NewHorizons/Builder/Props/DialogueBuilder.cs +++ b/NewHorizons/Builder/Props/DialogueBuilder.cs @@ -211,7 +211,8 @@ namespace NewHorizons.Builder.Props { XmlNode pageData = (XmlNode)Page; var text = pageData.InnerText; - TranslationHandler.AddDialogue(text, name); + // The text is trimmed in CharacterDialogueTree.LoadXml, so we also need to trim it for the key + TranslationHandler.AddDialogue(text, true, name); } xmlText = xmlNode2.SelectNodes("DialogueOptionsList/DialogueOption/Text"); @@ -219,7 +220,8 @@ namespace NewHorizons.Builder.Props { XmlNode pageData = (XmlNode)Page; var text = pageData.InnerText; - TranslationHandler.AddDialogue(text, characterName, name); + // The text is trimmed in DialogueText constructor (_listTextBlocks), so we also need to trim it for the key + TranslationHandler.AddDialogue(text, true, characterName, name); } } } diff --git a/NewHorizons/Handlers/TranslationHandler.cs b/NewHorizons/Handlers/TranslationHandler.cs index 03910e2b..38c6e76e 100644 --- a/NewHorizons/Handlers/TranslationHandler.cs +++ b/NewHorizons/Handlers/TranslationHandler.cs @@ -100,9 +100,9 @@ namespace NewHorizons.Handlers } } - public static void AddDialogue(string rawText, params string[] rawPreText) + public static void AddDialogue(string rawText, bool trimRawTextForKey = false, params string[] rawPreText) { - var key = string.Join(string.Empty, rawPreText) + rawText; + var key = string.Join(string.Empty, rawPreText) + (trimRawTextForKey? rawText.Trim() : rawText); var text = GetTranslation(rawText, TextType.DIALOGUE);