Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/java/org/mtransit/commons/CleanUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,9 @@ public static String cleanMergedID(@NotNull String mergedId) {
static final Pattern LINE = Pattern.compile("(^|\\s)(line)(\\s|$)", Pattern.CASE_INSENSITIVE);
static final String LINE_REPLACEMENT = "$1$3";

static final Pattern LIGNE = Pattern.compile("(^|\\s)(ligne)(\\s|$)", Pattern.CASE_INSENSITIVE);
static final String LIGNE_REPLACEMENT = "$1$3";

// http://www.semaphorecorp.com/cgi/abbrev.html
private static final Pattern STREET = cleanWords("street");
private static final String STREET_REPLACEMENT = cleanWordsReplacement("St");
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/org/mtransit/commons/StringsCleaner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ object StringsCleaner {
if (languages?.contains(Locale.ENGLISH) == true) {
routeLongName = CleanUtils.LINE.matcher(routeLongName).replaceAll(CleanUtils.LINE_REPLACEMENT)
}
if (languages?.contains(Locale.FRENCH) == true) {
routeLongName = CleanUtils.LIGNE.matcher(routeLongName).replaceAll(CleanUtils.LIGNE_REPLACEMENT)
}
Comment thread
mmathieum marked this conversation as resolved.
val makeShorter = routeLongName.length > ROUTE_LONG_NAME_SHORT_MAX_LENGTH && routeLongName.contains(' ')
routeLongName = cleanString(routeLongName, languages, lowerUCStrings, lowerUCWords, *ignoredUCWords, short = makeShorter, shortMaxLength = ROUTE_LONG_NAME_SHORT_MAX_LENGTH)
return routeLongName
Expand Down Expand Up @@ -50,6 +53,14 @@ object StringsCleaner {
}
}
}
if (languages?.contains(Locale.FRENCH) == true) {
when (routeType) {
1, // subway
-> {
tripHeadsign = CleanUtils.STATION.matcher(tripHeadsign).replaceAll(EMPTY)
}
}
Comment thread
mmathieum marked this conversation as resolved.
}
Comment thread
mmathieum marked this conversation as resolved.
if (languages?.contains(Locale.ENGLISH) == true) {
tripHeadsign = if (removeVia) {
CleanUtils.keepToAndRemoveVia(tripHeadsign)
Expand Down