public static String toLanguageTag(Locale locale){
  return locale.getLanguage() + (hasText(locale.getCountry()) ? "-" + locale.getCountry() : "");
}

public static String toLanguageTag ( Locale locale ) { return locale . getLanguage ( ) + ( hasText ( locale . getCountry ( ) ) ? "-" + locale . getCountry ( ) : "" ) ; }
determine the rfc 3066 compliant language tag , as used for the http " accept - language " header .
