Fix translating non-translatables

addnew adds a key when not found in original translation, which results
in translating to the old value when flipping back to that language. can
result in invalid values if the control is used as any data display (ie
Gender label)

https://projectpokemon.org/home/forums/topic/44926-when-i-changed-the-language-a-bug-about-gender-occurred/
This commit is contained in:
Kurt
2018-04-19 15:36:43 -07:00
parent 5b524188cd
commit cee43a3c4b
2 changed files with 2 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ public static void UpdateAll()
private static void UpdateTranslations()
{
WinFormsTranslator.SetRemovalMode(false); // add mode
WinFormsTranslator.LoadAllForms(LoadBanlist); // populate with every possible control
WinFormsTranslator.UpdateAll(DefaultLanguage, Languages); // propagate to others
WinFormsTranslator.DumpAll(Banlist); // dump current to file

View File

@@ -186,7 +186,7 @@ public static void RemoveAll(string defaultLanguage, params string[] banlist)
public class TranslationContext
{
public bool AddNew { private get; set; } = true;
public bool AddNew { private get; set; }
public bool RemoveUsedKeys { private get; set; }
public const char Separator = '=';
private readonly Dictionary<string, string> Translation = new Dictionary<string, string>();