From 9e87c59b68a0705f4155745d04f7096590cb8536 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 10 Feb 2016 14:31:53 +0000 Subject: [PATCH] Prefer Locale.ENGLISH when it makes sense --- source/net/filebot/media/MediaDetection.java | 2 +- source/net/filebot/media/ReleaseInfo.java | 5 ++--- source/net/filebot/similarity/EpisodeMetrics.java | 2 +- source/net/filebot/similarity/SequenceMatchSimilarity.java | 2 +- source/net/filebot/similarity/SeriesNameMatcher.java | 2 +- source/net/filebot/ui/rename/EpisodeListMatcher.java | 4 ++-- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/source/net/filebot/media/MediaDetection.java b/source/net/filebot/media/MediaDetection.java index cd2ffb93..d16bc545 100644 --- a/source/net/filebot/media/MediaDetection.java +++ b/source/net/filebot/media/MediaDetection.java @@ -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; diff --git a/source/net/filebot/media/ReleaseInfo.java b/source/net/filebot/media/ReleaseInfo.java index c89bc813..d55689b9 100644 --- a/source/net/filebot/media/ReleaseInfo.java +++ b/source/net/filebot/media/ReleaseInfo.java @@ -576,12 +576,11 @@ public class ReleaseInfo { public Map 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 order = (Comparator) collator; + Comparator order = collator; Map languageMap = new TreeMap(order); for (String code : Locale.getISOLanguages()) { diff --git a/source/net/filebot/similarity/EpisodeMetrics.java b/source/net/filebot/similarity/EpisodeMetrics.java index 5795e3cd..2ecc12a8 100644 --- a/source/net/filebot/similarity/EpisodeMetrics.java +++ b/source/net/filebot/similarity/EpisodeMetrics.java @@ -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) { diff --git a/source/net/filebot/similarity/SequenceMatchSimilarity.java b/source/net/filebot/similarity/SequenceMatchSimilarity.java index 13768b73..28d51aa9 100644 --- a/source/net/filebot/similarity/SequenceMatchSimilarity.java +++ b/source/net/filebot/similarity/SequenceMatchSimilarity.java @@ -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 diff --git a/source/net/filebot/similarity/SeriesNameMatcher.java b/source/net/filebot/similarity/SeriesNameMatcher.java index 79f864c0..360486e2 100644 --- a/source/net/filebot/similarity/SeriesNameMatcher.java +++ b/source/net/filebot/similarity/SeriesNameMatcher.java @@ -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) { diff --git a/source/net/filebot/ui/rename/EpisodeListMatcher.java b/source/net/filebot/ui/rename/EpisodeListMatcher.java index 7b68cf8c..0d2ce491 100644 --- a/source/net/filebot/ui/rename/EpisodeListMatcher.java +++ b/source/net/filebot/ui/rename/EpisodeListMatcher.java @@ -180,8 +180,8 @@ class EpisodeListMatcher implements AutoCompleteMatcher { List>>> tasks = new ArrayList>>>(); // remember user decisions and only bother user once - final Map selectionMemory = new TreeMap(CommonSequenceMatcher.getLenientCollator(Locale.ROOT)); - final Map> inputMemory = new TreeMap>(CommonSequenceMatcher.getLenientCollator(Locale.ROOT)); + final Map selectionMemory = new TreeMap(CommonSequenceMatcher.getLenientCollator(Locale.ENGLISH)); + final Map> inputMemory = new TreeMap>(CommonSequenceMatcher.getLenientCollator(Locale.ENGLISH)); // detect series names and create episode list fetch tasks if (strict) {