public static void CldrPatch() { var names = englishNames(); computeLangRegionEnglish(names); Teritory.createTeritoryTree(names); }
internal static void createTeritoryTree(EnglishNames names) { var ters = supplements. Descendants("territoryContainment"). Single().Elements("group"). Where(g => g.Attribute("status") == null && g.Attribute("grouping") == null). ToDictionary(el => el.Attribute("type").Value, el => el.Attribute("contains").Value.Split(' ')); // testUniq is empty => every region is unique in tree var testUniq = ters.SelectMany(kv => kv.Value.Select(Value => new { kv.Key, Value })).GroupBy(v => v.Value).Where(g => g.Count() > 1); if (testUniq.Count() > 0) { throw new Exception(); } // build tree var root = new Teritory(names, "001", ters); Json.Serialize(LangsDesignDirs.root + @"patches\cldrTeritoryTree.json", root); }