docs: protected MatchedLocale getBestMatch(Map<String,Locale> supportedLocales, String acceptLanguage) {
  		// Parse into language, country, and variant
  		String language;
  		String country;
  		String variant;
  		int pos1 = acceptLanguage.indexOf('-');
  		if(pos1 == -1) {
  			language = acceptLanguage;
  			country = "";
  			variant = "";
  		} else {
  			language = acceptLanguage.substring(0, pos1);
  			int pos2 = acceptLanguage.indexOf('-', pos1 + 1);
  			if(pos2 == -1) {
  				country = acceptLanguage.substring(pos1 + 1);
  				variant = "";
  			} else {
  				country = acceptLanguage.substring(pos1 + 1, pos2);
  				variant = acceptLanguage.substring(pos2 + 1);
  			}
  		}
  		if(!language.isEmpty()) {
  			language = language.toLowerCase(Locale.ROOT);
  			if(!country.isEmpty()) {
  				country = country.toUpperCase(Locale.ROOT);
  				if(!variant.isEmpty()) {
  					// Exact match on language, country, and variant
  					Locale match = supportedLocales.get(
  						toLocaleString(
  							new Locale(language, country, variant)
  						)
  					);
  					if(match != null) {
  						return new MatchedLocale(
  							match,
  							true
  						);
  					}
  				}
  				// Match on language and country
  				Locale match = supportedLocales.get(
  					toLocaleString(
  						new Locale(language, country)
  					)
  				);
  				if(match != null) {
  					return new MatchedLocale(
  						match,
  						variant.isEmpty()
  					);
  				}
  			}
  			// Match language
  			Locale match = supportedLocales.get(
  				toLocaleString(
  					new Locale(language)
  				)
  			);
  			if(match != null) {
  				return new MatchedLocale(
  					match,
  					country.isEmpty() && variant.isEmpty()
  				);
  			}
  		}
  		// No match
  		return null;
  	}