diff options
| author | Michael <[email protected]> | 2017-05-28 12:40:06 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-05-28 12:40:06 -0400 |
| commit | 03ebdf42d9f12b678d48f954736664f6f3eb1f84 (patch) | |
| tree | 3c16a83f0aed5a93ae9698c39ebf6c94ea2c56ed /ShiftOS_TheReturn/Localization.cs | |
| parent | 4036e97f3f3ecb6541cc623165e960e8c172f242 (diff) | |
| download | shiftos_thereturn-03ebdf42d9f12b678d48f954736664f6f3eb1f84.tar.gz shiftos_thereturn-03ebdf42d9f12b678d48f954736664f6f3eb1f84.tar.bz2 shiftos_thereturn-03ebdf42d9f12b678d48f954736664f6f3eb1f84.zip | |
Funny, disabling localization makes things easier...
Diffstat (limited to 'ShiftOS_TheReturn/Localization.cs')
| -rw-r--r-- | ShiftOS_TheReturn/Localization.cs | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/ShiftOS_TheReturn/Localization.cs b/ShiftOS_TheReturn/Localization.cs index 5d848b0..c542c2a 100644 --- a/ShiftOS_TheReturn/Localization.cs +++ b/ShiftOS_TheReturn/Localization.cs @@ -111,50 +111,11 @@ namespace ShiftOS.Engine localizationStrings = JsonConvert.DeserializeObject<Dictionary<string, string>>(Utils.ReadAllText(Paths.GetPath("english.local"))); //if no provider fall back to english } - foreach (var kv in localizationStrings) + foreach (var kv in localizationStrings.Where(x=>original.Contains(x.Key))) { original = original.Replace(kv.Key, kv.Value); // goes through and replaces all the localization blocks } - List<string> orphaned = new List<string>(); - - - int start_index = 0; - int length = 0; - bool indexing = false; - - foreach (var c in original) - { - // start paying attenion when you see a "{" - if (c == '{') - { - start_index = original.IndexOf(c); - indexing = true; - } - - if (indexing == true) - { - // stop paying attention when you see a "}" after seeing a "{" - length++; - if (c == '}') - { - indexing = false; - string o = original.Substring(start_index, length); - if (!orphaned.Contains(o)) - { - orphaned.Add(o); - } - start_index = 0; - length = 0; - } - } - } - - if (orphaned.Count > 0) - { - Utils.WriteAllText("0:/dev_orphaned_lang.txt", JsonConvert.SerializeObject(orphaned, Formatting.Indented)); //format if from this txt file - } - //string original2 = Parse(original); string usernameReplace = ""; @@ -203,13 +164,13 @@ namespace ShiftOS.Engine }; // actually do the replacement - foreach (KeyValuePair<string, string> replacement in replace) + foreach (KeyValuePair<string, string> replacement in replace.Where(x => original.Contains(x.Key))) { original = original.Replace(replacement.Key, Parse(replacement.Value)); } // do the replacement but default - foreach (KeyValuePair<string, string> replacement in defaultReplace) + foreach (KeyValuePair<string, string> replacement in defaultReplace.Where(x => original.Contains(x.Key))) { original = original.Replace(replacement.Key, replacement.Value); } |
