@@ -25,6 +25,12 @@ class LanguageCodes {
|
||||
return variations.toList();
|
||||
}
|
||||
|
||||
static String? getIso6391Code(String code) {
|
||||
final normalized = code.toLowerCase().trim().split(RegExp('[-_]')).first;
|
||||
if (normalized.isEmpty) return null;
|
||||
return _resolve(normalized)?.code1;
|
||||
}
|
||||
|
||||
/// Get a display name for a language/locale code.
|
||||
/// Handles plain codes ("en" → "English") and locale codes ("en-US" → "English",
|
||||
/// "en-AU" → "English (Australia)").
|
||||
|
||||
Reference in New Issue
Block a user