44using System . Threading . Tasks ;
55using System . Globalization ;
66using System . IO ;
7+ using System . Linq ;
78using System . Xml ;
89using System . Windows ;
910
@@ -17,7 +18,7 @@ public class TranslationProvider
1718 public bool IsDefault = true ;
1819
1920
20- private Dictionary < string , string > language = new Dictionary < string , string > ( ) ;
21+ private readonly Dictionary < string , string > language = new Dictionary < string , string > ( StringComparer . OrdinalIgnoreCase ) ;
2122
2223 public string GetLanguage ( string langID )
2324 {
@@ -35,7 +36,6 @@ public string GetLanguage(string langID)
3536 public void LoadLanguage ( string lang , bool Initial = false )
3637 {
3738 FillToEnglishDefaults ( ) ;
38- Dictionary < string , string > language = new Dictionary < string , string > ( ) ;
3939 List < string > languageList = new List < string > ( ) ;
4040 List < string > languageIDList = new List < string > ( ) ;
4141 languageList . Add ( "English" ) ;
@@ -52,6 +52,7 @@ public void LoadLanguage(string lang, bool Initial = false)
5252 {
5353 throw new Exception ( "No Root-Node: \" translations\" found" ) ;
5454 }
55+
5556 XmlNode rootLangNode = null ;
5657 foreach ( XmlNode childNode in document . ChildNodes [ 0 ] . ChildNodes )
5758 {
@@ -78,7 +79,7 @@ public void LoadLanguage(string lang, bool Initial = false)
7879 }
7980 string nn = node . Name . ToLowerInvariant ( ) ;
8081 string nv = node . InnerText ;
81- language . Add ( nn , nv ) ;
82+ language [ nn ] = nv ;
8283 }
8384 }
8485 }
@@ -96,7 +97,8 @@ public void LoadLanguage(string lang, bool Initial = false)
9697
9798 private void FillToEnglishDefaults ( )
9899 {
99- language . Add ( "Language" , "English" ) ;
100+ language . Clear ( ) ;
101+ language . Add ( "Language" , "English" ) ;
100102 language . Add ( "ServerRunning" , "Server running" ) ;
101103 language . Add ( "Saving" , "Saving" ) ;
102104 language . Add ( "SavingUFiles" , "Save all unsaved files?" ) ;
@@ -258,7 +260,7 @@ private void FillToEnglishDefaults()
258260 language . Add ( "RestartEdiFullEff" , "Restart editor to take full effect..." ) ;
259261 language . Add ( "RestartEdiEff" , "Restart editor to take effect..." ) ;
260262 language . Add ( "Program" , "Program" ) ;
261- language . Add ( "HardwareAcc" , "Use hardware acceleration (if available )" ) ;
263+ language . Add ( "HardwareAcc" , "Use hardware acceleration (if availablessss )" ) ;
262264 language . Add ( "UIAnim" , "UI animations" ) ;
263265 language . Add ( "OpenInc" , "Auto open includes" ) ;
264266 language . Add ( "OpenIncRec" , "Open Includes Recursively" ) ;
0 commit comments