getLangCodeFromItsStringRep static method
- String langCodeAsString
Converts a string representation of a language code back to its corresponding LangCode.
If the provided string is not a valid language code, the function will return LangCode.en as a failsafe to ensure the app always has a valid language code.
langCodeAsString: The string representation of the language code.
Returns the corresponding LangCode.
Implementation
static LangCode getLangCodeFromItsStringRep(String langCodeAsString) {
switch (langCodeAsString) {
case "de":
return LangCode.de;
case "en":
default:
return LangCode.en;
}
}