code: public static Locale getLocale(String locale) {
  
      String languageTag = locale.replace(SEPARATOR_DEFAULT, SEPARATOR_FOR_LANGUAGE_TAG);
      if (!languageTag.isEmpty() && (languageTag.charAt(0) == SEPARATOR_FOR_LANGUAGE_TAG)) {
        languageTag = languageTag.substring(1); // tolerant for accepting suffixes like "_en_US" / "-en-US"
      }
      return Locale.forLanguageTag(languageTag);
    }
docs: Create a {@link Locale} from a given {@link String} representation such as {@link Locale#toString()} or
  {@link Locale#forLanguageTag(String)}.
  
  @param locale the {@link String} representation of the {@link Locale}.
  @return the parsed {@link Locale}.
  @since 7.3.0