1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-02 08:25:02 -04:00

Support localized month names when matching dates

This commit is contained in:
Reinhard Pointner 2016-02-10 14:33:53 +00:00
parent c12df53182
commit a81fcf155a

View File

@ -59,7 +59,7 @@ public class DateMatcher {
protected DatePattern[] compile(List<String> patterns, Locale locale, DateFilter sanity) { protected DatePattern[] compile(List<String> patterns, Locale locale, DateFilter sanity) {
return StreamEx.of(patterns).flatMap(dateFormat -> { return StreamEx.of(patterns).flatMap(dateFormat -> {
return StreamEx.of(Locale.ENGLISH, locale).distinct().map(formatLocale -> { return StreamEx.of(Locale.ENGLISH, locale).distinct().map(formatLocale -> {
String regex = StreamEx.of(dateFormat.split(DateFormatPattern.DELIMITER)).map(g -> getPatternGroup(g, formatLocale)).joining("\\D", "(?<!\\p{Alnum})", "(?!\\p{Alnum})"); String regex = StreamEx.split(dateFormat, DateFormatPattern.DELIMITER).map(g -> getPatternGroup(g, formatLocale)).joining("\\D", "(?<!\\p{Alnum})", "(?!\\p{Alnum})");
return new DateFormatPattern(regex, dateFormat, formatLocale, sanity); return new DateFormatPattern(regex, dateFormat, formatLocale, sanity);
}).distinct(DateFormatPattern::toString); }).distinct(DateFormatPattern::toString);
}).toArray(DateFormatPattern[]::new); }).toArray(DateFormatPattern[]::new);