static Locale parseLanguageTag(String languageTag){
  String localeParts[]=languageTag.split("_",3);
  if (localeParts.length >= 2) {
    return new Locale(localeParts[0],localeParts[1]);
  }
 else   if (localeParts.length >= 1) {
    return new Locale(localeParts[0]);
  }
 else {
    return Locale.ENGLISH;
  }
}

static Locale parseLanguageTag ( String languageTag ) { String localeParts [ ] = languageTag . split ( "_" , 3 ) ; if ( localeParts . length >= 2 ) { return new Locale ( localeParts [ 0 ] , localeParts [ 1 ] ) ; } else if ( localeParts . length >= 1 ) { return new Locale ( localeParts [ 0 ] ) ; } else { return Locale . ENGLISH ; } }
get the locale from a language tag ' s language and country . the variant is discarded . returns locale . english on failure .
