setLanguage static method

bool setLanguage(
  1. String language
)

Implementation

static bool setLanguage(String language) {
  var resources = stringResources.getLanguageResources(language);
  if (resources == null) {
    // A language code can be something like 'en', 'en-US' or 'en_US'
    language = language.split("-")[0].split("_")[0];
    resources = stringResources.getLanguageResources(language);
  }

  if (resources == null) {
    return false;
  }

  _language = language;
  Strings.load(resources, clear: true);
  return true;
}