private void OnChange(IDictionary <string, string> collection, string[] changedKeys) { if (!suppressChange) { try { suppressChange = true; if (collection == UExtensions) { SingletonSubtags["u"] = FormatUExtension(); } else if (collection == TExtensions) { SingletonSubtags["t"] = FormatTExtension(); } else { if (Array.IndexOf(changedKeys, "t") >= 0 || Array.IndexOf(changedKeys, "T") >= 0) { TExtensions.Clear(); if (collection.TryGetValue("t", out string value) && !String.IsNullOrEmpty(value)) { BcpLanguageTag t = BcpLanguageTag.Parse("root-t-" + value); foreach (KeyValuePair <string, string> a in t.TExtensions) { TExtensions.Add(a); } TLang = t.TLang; } else { TLang = ""; } } if (Array.IndexOf(changedKeys, "u") >= 0 || Array.IndexOf(changedKeys, "U") >= 0) { UExtensions.Clear(); Attributes.Clear(); if (collection.TryGetValue("u", out string value) && !String.IsNullOrEmpty(value)) { BcpLanguageTag t = BcpLanguageTag.Parse("root-u-" + value); foreach (KeyValuePair <string, string> a in t.UExtensions) { UExtensions.Add(a); } foreach (string a in t.Attributes) { Attributes.Add(a); } } } } } finally { suppressChange = false; } } }