Prefer Locale.ENGLISH when it makes sense

This commit is contained in:
Reinhard Pointner 2016-02-10 14:31:53 +00:00
parent 331f51caf7
commit 9e87c59b68
6 changed files with 8 additions and 9 deletions

View File

@ -117,7 +117,7 @@ public class MediaDetection {
private static final SeasonEpisodeMatcher seasonEpisodeMatcherStrict = new SmartSeasonEpisodeMatcher(true);
private static final SeasonEpisodeMatcher seasonEpisodeMatcherNonStrict = new SmartSeasonEpisodeMatcher(false);
private static final DateMatcher dateMatcher = new DateMatcher(Locale.ROOT, DateMatcher.DEFAULT_SANITY);
private static final DateMatcher dateMatcher = new DateMatcher(Locale.getDefault(), DateMatcher.DEFAULT_SANITY);
public static SeasonEpisodeMatcher getSeasonEpisodeMatcher(boolean strict) {
return strict ? seasonEpisodeMatcherStrict : seasonEpisodeMatcherNonStrict;

View File

@ -576,12 +576,11 @@ public class ReleaseInfo {
public Map<String, Locale> getLanguageMap(Locale... supportedDisplayLocale) {
// use maximum strength collator by default
Collator collator = Collator.getInstance(Locale.ROOT);
Collator collator = Collator.getInstance(Locale.ENGLISH);
collator.setDecomposition(Collator.FULL_DECOMPOSITION);
collator.setStrength(Collator.PRIMARY);
@SuppressWarnings("unchecked")
Comparator<String> order = (Comparator) collator;
Comparator<? super String> order = collator;
Map<String, Locale> languageMap = new TreeMap<String, Locale>(order);
for (String code : Locale.getISOLanguages()) {

View File

@ -303,7 +303,7 @@ public enum EpisodeMetrics implements SimilarityMetric {
// Match by generic name similarity (absolute)
SeriesName(new NameSimilarityMetric() {
private SeriesNameMatcher seriesNameMatcher = new SeriesNameMatcher(Locale.ROOT, false);
private SeriesNameMatcher seriesNameMatcher = new SeriesNameMatcher(Locale.ENGLISH, false);
@Override
public float getSimilarity(Object o1, Object o2) {

View File

@ -15,7 +15,7 @@ public class SequenceMatchSimilarity implements SimilarityMetric {
}
public SequenceMatchSimilarity(int commonSequenceMaxStartIndex, boolean returnFirstMatch) {
this.commonSequenceMatcher = new CommonSequenceMatcher(getLenientCollator(Locale.ROOT), commonSequenceMaxStartIndex, returnFirstMatch);
this.commonSequenceMatcher = new CommonSequenceMatcher(getLenientCollator(Locale.ENGLISH), commonSequenceMaxStartIndex, returnFirstMatch);
}
@Override

View File

@ -38,7 +38,7 @@ public class SeriesNameMatcher {
protected CommonSequenceMatcher commonSequenceMatcher;
public SeriesNameMatcher() {
this(Locale.ROOT, true);
this(Locale.ENGLISH, true);
}
public SeriesNameMatcher(Locale locale, boolean strict) {

View File

@ -180,8 +180,8 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
List<Callable<List<Match<File, ?>>>> tasks = new ArrayList<Callable<List<Match<File, ?>>>>();
// remember user decisions and only bother user once
final Map<String, SearchResult> selectionMemory = new TreeMap<String, SearchResult>(CommonSequenceMatcher.getLenientCollator(Locale.ROOT));
final Map<String, List<String>> inputMemory = new TreeMap<String, List<String>>(CommonSequenceMatcher.getLenientCollator(Locale.ROOT));
final Map<String, SearchResult> selectionMemory = new TreeMap<String, SearchResult>(CommonSequenceMatcher.getLenientCollator(Locale.ENGLISH));
final Map<String, List<String>> inputMemory = new TreeMap<String, List<String>>(CommonSequenceMatcher.getLenientCollator(Locale.ENGLISH));
// detect series names and create episode list fetch tasks
if (strict) {