mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Manually add to dicts to avoid duplicate translation error spam
This commit is contained in:
parent
e46ceefe04
commit
3084a97df1
@ -121,22 +121,36 @@ namespace NewHorizons.Handlers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static (string, string) FixKeyValue(string key, string value)
|
||||||
|
{
|
||||||
|
key = key.Replace("<", "<").Replace(">", ">").Replace("<![CDATA[", "").Replace("]]>", "");
|
||||||
|
value = value.Replace("<", "<").Replace(">", ">").Replace("<![CDATA[", "").Replace("]]>", "");
|
||||||
|
|
||||||
|
return (key, value);
|
||||||
|
}
|
||||||
|
|
||||||
public static void AddDialogue(string rawText, bool trimRawTextForKey = false, params string[] rawPreText)
|
public static void AddDialogue(string rawText, bool trimRawTextForKey = false, params string[] rawPreText)
|
||||||
{
|
{
|
||||||
var key = string.Join(string.Empty, rawPreText) + (trimRawTextForKey? rawText.Trim() : rawText);
|
var key = string.Join(string.Empty, rawPreText) + (trimRawTextForKey? rawText.Trim() : rawText);
|
||||||
|
|
||||||
var text = GetTranslation(rawText, TextType.DIALOGUE);
|
var value = GetTranslation(rawText, TextType.DIALOGUE);
|
||||||
|
|
||||||
TextTranslation.Get().m_table.Insert(key, text);
|
// Manually insert directly into the dictionary, otherwise it logs errors about duplicates but we want to allow replacing
|
||||||
|
(key, value) = FixKeyValue(key, value);
|
||||||
|
|
||||||
|
TextTranslation.Get().m_table.theTable[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddShipLog(string rawText, params string[] rawPreText)
|
public static void AddShipLog(string rawText, params string[] rawPreText)
|
||||||
{
|
{
|
||||||
var key = string.Join(string.Empty, rawPreText) + rawText;
|
var key = string.Join(string.Empty, rawPreText) + rawText;
|
||||||
|
|
||||||
string text = GetTranslation(rawText, TextType.SHIPLOG);
|
string value = GetTranslation(rawText, TextType.SHIPLOG);
|
||||||
|
|
||||||
TextTranslation.Get().m_table.InsertShipLog(key, text);
|
// Manually insert directly into the dictionary, otherwise it logs errors about duplicates but we want to allow replacing
|
||||||
|
(key, value) = FixKeyValue(key, value);
|
||||||
|
|
||||||
|
TextTranslation.Get().m_table.theShipLogTable[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int AddUI(string rawText)
|
public static int AddUI(string rawText)
|
||||||
@ -154,7 +168,7 @@ namespace NewHorizons.Handlers
|
|||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
|
|
||||||
TextTranslation.Get().m_table.Insert_UI(key, text);
|
TextTranslation.Get().m_table.theUITable[key] = text;
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user