getLanguage static method
Get the matching language
Implementation
static QudsLanguage? getLanguage(String? code) {
if (code == null) return null;
var result = languages[code];
if (result != null) return result;
var codeParts = code.split('_');
if (codeParts.isEmpty) return null;
if (codeParts.length == 1) {
for (var l in languages.keys) {
if (l.split('_')[0].toLowerCase() == code.toLowerCase()) {
return languages[l];
}
}
}
if (codeParts.length == 2) {
for (var l in languages.keys) {
if (l.toLowerCase() == code.toLowerCase()) return languages[l];
}
}
return null;
}