ICU-13829 Merge pull request #25 from gnrunge/icu4j_13829

ICU-13829 Languagematcher: Fixes straightforward code issues.
This commit is contained in:
gnrunge 2018-07-30 14:00:01 -07:00 committed by Shane Carr
commit 77a1c43f46
No known key found for this signature in database
GPG key ID: FCED3B24AAB18B5C
3 changed files with 5 additions and 6 deletions

View file

@ -143,8 +143,8 @@ public class XLikelySubtags {
throw new ICUException("too many subtags");
}
String lang = parts[0].toLowerCase();
String p2 = parts.length < 2 ? "": parts[1];
String p3 = parts.length < 3 ? "": parts[2];
String p2 = parts.length < 2 ? "" : parts[1];
String p3 = parts.length < 3 ? "" : parts[2];
return p2.length() < 4 ? new LSR(lang, "", p2) : new LSR(lang, p2, p3);
// Matcher matcher = LANGUAGE_PATTERN.matcher(languageIdentifier);
@ -166,7 +166,7 @@ public class XLikelySubtags {
public static LSR fromMaximalized(String language, String script, String region) {
String canonicalLanguage = LANGUAGE_ALIASES.getCanonical(language);
// script is ok
String canonicalRegion = REGION_ALIASES.getCanonical(region); // getCanonical(REGION_ALIASES.get(region));
String canonicalRegion = REGION_ALIASES.getCanonical(region);
return DEFAULT.maximize(canonicalLanguage, script, canonicalRegion);
}

View file

@ -739,7 +739,7 @@ public class XLocaleDistance {
* ULocales must be in canonical, addLikelySubtags format. Returns distance
*/
public int distanceRaw(
String desiredLang, String supportedlang,
String desiredLang, String supportedLang,
String desiredScript, String supportedScript,
String desiredRegion, String supportedRegion,
int threshold,
@ -747,7 +747,7 @@ public class XLocaleDistance {
Output<DistanceTable> subtable = new Output<DistanceTable>();
int distance = languageDesired2Supported.getDistance(desiredLang, supportedlang, subtable, true);
int distance = languageDesired2Supported.getDistance(desiredLang, supportedLang, subtable, true);
boolean scriptFirst = distanceOption == DistanceOption.SCRIPT_FIRST;
if (scriptFirst) {
distance >>= 2;

View file

@ -40,7 +40,6 @@ public class XLocaleMatcher {
private final Set<ULocale> exactSupportedLocales; // the locales in the collection are ordered!
private final ULocale defaultLanguage;
public static class Builder {
private Set<ULocale> supportedLanguagesList;
private int thresholdDistance = -1;