-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Route longName translations #4356
Conversation
…GraphQLQueryTimeImpl so it suits better for translated strings for route longName property
...t/java/org/opentripplanner/ext/legacygraphqlapi/datafetchers/LegacyGraphQLQueryTypeImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opentripplanner/gtfs/mapping/RouteMapper.java
Outdated
Show resolved
Hide resolved
…st accordingly. Removed nullcheker for translationHelper, as it is not needed anymore
Codecov Report
@@ Coverage Diff @@
## dev-2.x #4356 +/- ##
=============================================
+ Coverage 57.93% 58.08% +0.14%
- Complexity 11004 11071 +67
=============================================
Files 1450 1455 +5
Lines 58690 58776 +86
Branches 6758 6770 +12
=============================================
+ Hits 34004 34139 +135
+ Misses 22644 22599 -45
+ Partials 2042 2038 -4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
src/ext/java/org/opentripplanner/ext/legacygraphqlapi/LegacyGraphQLUtils.java
Show resolved
Hide resolved
src/main/java/org/opentripplanner/transit/model/network/RouteBuilder.java
Show resolved
Hide resolved
routeStream.filter(route -> { | ||
if ( | ||
route.getShortName() != null && | ||
LegacyGraphQLUtils.startsWith(route.getShortName(), name, environment.getLocale()) | ||
) { | ||
return true; | ||
} | ||
return ( | ||
route.getLongName() != null && | ||
LegacyGraphQLUtils.startsWith(route.getLongName(), name, environment.getLocale()) | ||
); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add a null check in LegacyGraphQLUtils.startsWith
, this could be simplified down to
routeStream.filter(route -> { | |
if ( | |
route.getShortName() != null && | |
LegacyGraphQLUtils.startsWith(route.getShortName(), name, environment.getLocale()) | |
) { | |
return true; | |
} | |
return ( | |
route.getLongName() != null && | |
LegacyGraphQLUtils.startsWith(route.getLongName(), name, environment.getLocale()) | |
); | |
}); | |
routeStream.filter(route -> | |
LegacyGraphQLUtils.startsWith(route.getShortName(), name, environment.getLocale()) || | |
LegacyGraphQLUtils.startsWith(route.getLongName(), name, environment.getLocale()) | |
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/ext/java/org/opentripplanner/ext/legacygraphqlapi/LegacyGraphQLUtils.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how concise the change is in the graphql API.
Summary
This PR will adds translation to Route's longName property.
Issue
This PR relates to issue #2832
Unit tests
Unit tests have been updated where necessary.
Documentation
Documentation hasn't been updated in this PR.