getLangCodeFromLocale static method
- Locale locale
Retrieves the supported LangCode from a user's locale.
This function maps the system locale to one of the supported languages. If the locale is not supported, it defaults to LangCode.en.
locale: TheLocaleobject to retrieve the language from.
Returns the corresponding LangCode for the provided locale.
Implementation
static LangCode getLangCodeFromLocale(Locale locale) {
switch (locale.languageCode) {
case "de":
return LangCode.de;
case "en":
default:
return LangCode.en;
}
}