Fix dialog text not trimmed in translation table key

This commit is contained in:
Damián Garro 2022-09-09 18:48:31 -03:00
parent 9e646753f8
commit e450a2b459
2 changed files with 6 additions and 4 deletions

View File

@ -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);
}
}
}

View File

@ -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);