Skip to content

Use locale param if one is defined over accept-language header in GTFS APIs #6552

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

Merged
merged 2 commits into from
Mar 24, 2025

Conversation

optionsome
Copy link
Member

Summary

Previously if both accept-language header and locale param were defined, env would be used. This changes the prioritization so that the locale param is used.

Issue

No issue

Unit tests

Update tests

Documentation

Not needed

Changelog

From title

@optionsome optionsome added the Improvement A functional improvement label Mar 18, 2025
@optionsome optionsome added this to the 2.8 (next release) milestone Mar 18, 2025
@optionsome optionsome requested a review from a team as a code owner March 18, 2025 21:49
Copy link

codecov bot commented Mar 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.24%. Comparing base (c2355db) to head (6013f69).
Report is 39 commits behind head on dev-2.x.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6552      +/-   ##
=============================================
- Coverage      70.25%   70.24%   -0.01%     
+ Complexity     18387    18381       -6     
=============================================
  Files           2088     2088              
  Lines          77425    77410      -15     
  Branches        7843     7840       -3     
=============================================
- Hits           54395    54377      -18     
- Misses         20258    20264       +6     
+ Partials        2772     2769       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

}

return userLocale;
var envLocale = environment.getLocale();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question about names:

  • localContextLocale is the one passed in the GraphQL query body
  • env Locale is passed the one from the HTTP header Accept-Language

Correct?

If so, can you write a few lines in this class? It would help me understand what is going on.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some comments in this method that explain this. But I'll clarify the comments a bit and add javadoc to methods.

Copy link
Member

@leonardehrenfried leonardehrenfried left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a few lines of Javadoc to GraphQLUtils?

Copy link
Member

@leonardehrenfried leonardehrenfried left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is some excellent Javadoc.

@optionsome optionsome merged commit 546b56e into opentripplanner:dev-2.x Mar 24, 2025
6 checks passed
@optionsome optionsome deleted the prefer-locale-param branch March 24, 2025 15:16
t2gran pushed a commit that referenced this pull request Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement A functional improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants