Skip to content

Instantly share code, notes, and snippets.

@svick
Created December 7, 2021 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svick/65966b86c33013e43b13da27b8a63b5f to your computer and use it in GitHub Desktop.
Save svick/65966b86c33013e43b13da27b8a63b5f to your computer and use it in GitHub Desktop.
using var stream = File.OpenText(@"C:\Users\Svick\Desktop\iso-639-3.tab");
using var reader = new CsvReader(stream, new(CultureInfo.InvariantCulture) { Delimiter = "\t" });
var dict = reader.GetRecords(new { Id = "", Ref_Name = "" }).ToDictionary(x => x.Id, x => x.Ref_Name);
CultureInfo.GetCultures(CultureTypes.NeutralCultures)
.Where(c => c.TwoLetterISOLanguageName.Length > 2 && (!dict.TryGetValue(c.TwoLetterISOLanguageName, out string isoName) || isoName != c.EnglishName))
.Select(c => new { c.Name, c.TwoLetterISOLanguageName, c.EnglishName, IsoName = dict[c.TwoLetterISOLanguageName] })
.Dump();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment