docs: public Locale parseLocale(String localeString) {
          String language = null;
          String country = null;
          String variant = null;
  
          // Sometimes people specify "en-US" instead of "en_US", so
          // we'll try to clean that up.
          localeString = localeString.replaceAll("-", "_");
  
          StringTokenizer st = new StringTokenizer(localeString, "_");
  
          if (st.hasMoreTokens()) {
              language = st.nextToken();
          }
          if (st.hasMoreTokens()) {
              country = st.nextToken();
          }
          if (st.hasMoreTokens()) {
              variant = st.nextToken();
          }
  
          Locale locale = null;
  
          if (variant != null) {
              locale = new Locale(language, country, variant);
          } else if (country != null) {
              locale = new Locale(language, country);
          } else if (language != null) {
              locale = new Locale(language);
          }
  
          return locale;
      }