graphql-java-kickstart/graphql-java-servlet

Locale Information from the Request are not Respected in the Execution Context

Opened this issue · 0 comments

Describe the bug
When a locale setting is transported through a HTTP request, using a Accept-Language header, this information seems not to be transported to the ExecutionContext, finally not ending up in the DataFetchingEnvironment where I want to use it. The locale that I receive on the DataFetchingEnvironment is the default locale of the Java Runtime Environment.

To Reproduce
Steps to reproduce the behavior:

  1. Implement a locale-dependent data fetching.
  2. Change the language, i.e. the Accept-Language header changes.
  3. The shown text is still in the default locale of the server system.

Expected behavior
I expect the locale information to be available at the DataFetchingEnvironment, as it has been sent with the Accept-Language header in the HTTP requests. The shown/returned text from the GraphQL interface is then switched to the expected locale (if correctly implemented).

Screenshots
No screenshots atm. Topic is more implementation-related.

Desktop (please complete the following information):

  • OS: N/A (Windows in my case)
  • Browser: N/A (Chrome in my case)
  • Version: Windows 11, Chrome Version 133.0.6943.142

Additional context
I guess the information is somehow "lost" on the way from the HTTP request object to the DataFetchingEnvironment instance.