Skip to content

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

Merged
optionsome merged 2 commits into
opentripplanner:dev-2.xfrom
HSLdevcom:prefer-locale-param
Mar 24, 2025
Merged

Use locale param if one is defined over accept-language header in GTFS APIs#6552
optionsome merged 2 commits into
opentripplanner:dev-2.xfrom
HSLdevcom:prefer-locale-param

Conversation

@optionsome

Copy link
Copy Markdown
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 or micro feature 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
@codecov

codecov Bot commented Mar 18, 2025

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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.

@leonardehrenfried leonardehrenfried left a comment

Copy link
Copy Markdown
Member

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?

@leonardehrenfried leonardehrenfried left a comment

Copy link
Copy Markdown
Member

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
@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 or micro feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants