class Locales {

  public static Locale fromString(final String string) {
    if (string == null) {
      return null;
    } else {
      try {
        /*
         *  prefer https://en.wikipedia.org/wiki/IETF_language_tag
         *  (only Locale.Builder throws exception for illegal format)
         */
        return new Locale.Builder().setLanguageTag(string).build();
      } catch (final IllformedLocaleException ex) {
        // use fallback
        return LocaleUtils.toLocale(string);
      }
    }
  }

  private  Locales();

}