localeFromString function
Converts a language code string to a corresponding Locale.
Returns null if the provided languageCode
is null or empty.
languageCode
The language code to convert to a Locale.
Implementation
Locale? localeFromString(final String? languageCode) {
if (languageCode == null || languageCode.isEmpty) return null;
return UiLanguage.byCode(languageCode)?.locale;
}