fromString static method

I18nLocale fromString(
  1. String localeRaw
)

Implementation

static I18nLocale fromString(String localeRaw) {
  final match = RegexUtils.localeRegex.firstMatch(localeRaw);
  if (match != null) {
    final language = match.group(1)!;
    final script = match.group(2);
    final country = match.group(3);
    return I18nLocale(language: language, script: script, country: country);
  }
  return I18nLocale(language: localeRaw);
}