shortLocale function

String shortLocale(
  1. String aLocale
)

Return the short version of a locale name, e.g. 'en_US' => 'en'

Implementation

String shortLocale(String aLocale) {
  if (aLocale.length < 2) return aLocale;
  return aLocale.substring(0, 2).toLowerCase();
}