Make Culture lookup case-insensitive; add GetOrDefault()

Changed Culture indexer to use case-insensitive language matching.
Added GetOrDefault() to return a Culture or the default if not found.
This commit is contained in:
2026-02-11 13:50:02 +01:00
parent 9f59a17f63
commit 91eb5d1e64

View File

@@ -7,7 +7,9 @@
public IEnumerable<string> FIClasses => this.Select(c => c.FIClass);
public Culture Default => this.First();
public Culture? this[string? language] => language is null ? null : this.Where(c => c.Language == language).FirstOrDefault();
public Culture GetOrDefault(string? language) => this[language] ?? Default;
public Culture? this[string? language] => language is null ? null : this.FirstOrDefault(c => string.Equals(c.Language, language, StringComparison.OrdinalIgnoreCase));
}
}