getCurrentLocal method

Locale getCurrentLocal({
  1. LanguageVo? def,
})

获取当前语言的local

Implementation

Locale getCurrentLocal({LanguageVo? def}) {
  LanguageVo? oldLang =
      KSpUtils.getT(_langKey, (json) => LanguageVo.fromJson(json));
  if (oldLang == null) {
    if (def == null) {
      _langVo = LanguageVo.toSystem();
      return Locale(Intl.systemLocale);
    } else {
      _langVo = def;
      return Locale(def.languageCode, def.countryCode);
    }
  } else {
    _langVo = oldLang;
    return Locale(oldLang.languageCode, oldLang.countryCode);
  }
}