Prefer Locale.ENGLISH when it makes sense
This commit is contained in:
parent
331f51caf7
commit
9e87c59b68
|
@ -117,7 +117,7 @@ public class MediaDetection {
|
||||||
|
|
||||||
private static final SeasonEpisodeMatcher seasonEpisodeMatcherStrict = new SmartSeasonEpisodeMatcher(true);
|
private static final SeasonEpisodeMatcher seasonEpisodeMatcherStrict = new SmartSeasonEpisodeMatcher(true);
|
||||||
private static final SeasonEpisodeMatcher seasonEpisodeMatcherNonStrict = new SmartSeasonEpisodeMatcher(false);
|
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) {
|
public static SeasonEpisodeMatcher getSeasonEpisodeMatcher(boolean strict) {
|
||||||
return strict ? seasonEpisodeMatcherStrict : seasonEpisodeMatcherNonStrict;
|
return strict ? seasonEpisodeMatcherStrict : seasonEpisodeMatcherNonStrict;
|
||||||
|
|
|
@ -576,12 +576,11 @@ public class ReleaseInfo {
|
||||||
|
|
||||||
public Map<String, Locale> getLanguageMap(Locale... supportedDisplayLocale) {
|
public Map<String, Locale> getLanguageMap(Locale... supportedDisplayLocale) {
|
||||||
// use maximum strength collator by default
|
// use maximum strength collator by default
|
||||||
Collator collator = Collator.getInstance(Locale.ROOT);
|
Collator collator = Collator.getInstance(Locale.ENGLISH);
|
||||||
collator.setDecomposition(Collator.FULL_DECOMPOSITION);
|
collator.setDecomposition(Collator.FULL_DECOMPOSITION);
|
||||||
collator.setStrength(Collator.PRIMARY);
|
collator.setStrength(Collator.PRIMARY);
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
Comparator<? super String> order = collator;
|
||||||
Comparator<String> order = (Comparator) collator;
|
|
||||||
Map<String, Locale> languageMap = new TreeMap<String, Locale>(order);
|
Map<String, Locale> languageMap = new TreeMap<String, Locale>(order);
|
||||||
|
|
||||||
for (String code : Locale.getISOLanguages()) {
|
for (String code : Locale.getISOLanguages()) {
|
||||||
|
|
|
@ -303,7 +303,7 @@ public enum EpisodeMetrics implements SimilarityMetric {
|
||||||
// Match by generic name similarity (absolute)
|
// Match by generic name similarity (absolute)
|
||||||
SeriesName(new NameSimilarityMetric() {
|
SeriesName(new NameSimilarityMetric() {
|
||||||
|
|
||||||
private SeriesNameMatcher seriesNameMatcher = new SeriesNameMatcher(Locale.ROOT, false);
|
private SeriesNameMatcher seriesNameMatcher = new SeriesNameMatcher(Locale.ENGLISH, false);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getSimilarity(Object o1, Object o2) {
|
public float getSimilarity(Object o1, Object o2) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class SequenceMatchSimilarity implements SimilarityMetric {
|
||||||
}
|
}
|
||||||
|
|
||||||
public SequenceMatchSimilarity(int commonSequenceMaxStartIndex, boolean returnFirstMatch) {
|
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
|
@Override
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class SeriesNameMatcher {
|
||||||
protected CommonSequenceMatcher commonSequenceMatcher;
|
protected CommonSequenceMatcher commonSequenceMatcher;
|
||||||
|
|
||||||
public SeriesNameMatcher() {
|
public SeriesNameMatcher() {
|
||||||
this(Locale.ROOT, true);
|
this(Locale.ENGLISH, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SeriesNameMatcher(Locale locale, boolean strict) {
|
public SeriesNameMatcher(Locale locale, boolean strict) {
|
||||||
|
|
|
@ -180,8 +180,8 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
|
||||||
List<Callable<List<Match<File, ?>>>> tasks = new ArrayList<Callable<List<Match<File, ?>>>>();
|
List<Callable<List<Match<File, ?>>>> tasks = new ArrayList<Callable<List<Match<File, ?>>>>();
|
||||||
|
|
||||||
// remember user decisions and only bother user once
|
// remember user decisions and only bother user once
|
||||||
final Map<String, SearchResult> selectionMemory = new TreeMap<String, SearchResult>(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.ROOT));
|
final Map<String, List<String>> inputMemory = new TreeMap<String, List<String>>(CommonSequenceMatcher.getLenientCollator(Locale.ENGLISH));
|
||||||
|
|
||||||
// detect series names and create episode list fetch tasks
|
// detect series names and create episode list fetch tasks
|
||||||
if (strict) {
|
if (strict) {
|
||||||
|
|
Loading…
Reference in New Issue