public static void MergeOldToCldr() { var olds = new LangMatrix(LangsDesignDirs.otherappdata + "oldVersionInfo.csv"); olds.langs.ForEach((l, idx) => { var cldr = Langs.nameToMeta[Langs.oldToNew(l)]; var old = olds.data[idx]; cldr.BreakerClass = old[0]; cldr.StemmerClass = old[1]; //cldr.IsEuroTalk = old[2] != null; //cldr.IsLingea = old[3] != null; //cldr.IsGoethe = old[4] != null; int.TryParse(old[6], out cldr.LCID); cldr.GoogleTransId = old[7]; cldr.WordSpellCheckLCID = old[8] != null ? int.Parse(old[8]) : 0; cldr.Name = old[9]; }); // prepare langGuids var withGuid = Langs.meta. Where(m => (m.BreakerClass != null) && m.Lang != "zh" && m.Id != "en-US" && m.Lang != "pt" && m.Lang != "sr"); var dupls2 = withGuid.GroupBy(m => m.Lang).Where(g => g.Count() > 1).ToArray(); var dupls = withGuid.GroupBy(m => m.Lang).Where(g => g.Count() > 1).Select(g => g.Key).ToArray(); var langGuids = withGuid.Where(m => !dupls.Contains(m.Lang)).ToDictionary(m => m.Lang, m => new { m.StemmerClass, m.BreakerClass }); // prepare scriptGuids withGuid = Langs.meta. Where(m => (m.BreakerClass != null) && m.Lang != "zh" && m.Id != "en-US" && m.Lang != "pt" && m.Lang != "sr" && m.Id != "ur-PK"); dupls2 = withGuid.GroupBy(m => m.ScriptId).Where(g => g.Count() > 1).ToArray(); dupls = withGuid.GroupBy(m => m.ScriptId).Where(g => g.Count() > 1).Select(g => g.Key).ToArray(); var scriptGuids = withGuid.Where(m => !dupls.Contains(m.ScriptId)).ToDictionary(m => m.ScriptId, m => m.BreakerClass); //expand breaking and stemming GUID to other langs foreach (var m in Langs.meta.Where(m => m.StemmerClass == null && m.BreakerClass == null && langGuids.ContainsKey(m.Lang))) { var lg = langGuids[m.Lang]; m.StemmerClass = lg.StemmerClass; m.BreakerClass = lg.BreakerClass; } foreach (var m in Langs.meta.Where(m => m.BreakerClass == null && scriptGuids.ContainsKey(m.ScriptId))) { m.BreakerClass = scriptGuids[m.ScriptId]; } // alphabets var alphs = new LangMatrix(LangsDesignDirs.cldr + "alphaRoot.csv"); var ignAlphas = new HashSet <string>() { "Hant", "Hans", "Jpan", "Kore" }; Langs.meta.ForEach(m => { m.Alphabet = ""; m.AlphabetUpper = null; if (!ignAlphas.Contains(m.ScriptId)) { Langs.getFullNames(m).ForEach(n => m.Alphabet += alphs[n.ToString(), 0]); } finishAlphabet(m); if (m.Alphabet.Length == 0) { m.Alphabet = null; } else { m.Alphabet = new String(m.Alphabet.Distinct().OrderBy(ch => ch).ToArray()); m.AlphabetUpper = m.Alphabet.ToUpper(); } }); Langs.save(); }