Skip to content

Conversation

@afzal09
Copy link
Contributor

@afzal09 afzal09 commented Dec 4, 2025

Proposed Changes

  • send accept language header with request for localized errors
  • get selected languages from user browser

Related Issue(s)

Closes Send selected language in request header #1132

Please check that the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)

src/utils/url.ts Outdated
}

export function getAcceptLanguage():string{
const languages = navigator.languages || []; // get language preference from user's browser settings
Copy link
Member

@rolandgeider rolandgeider Dec 5, 2025

Choose a reason for hiding this comment

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

I'm not sure right now, but where do the languages the languages in navigator come from? Are these only the ones set in the browser preferences?

In any case, the user can also manually change the app's language with the parameter in the URL, so we should make sure we send that one as the first entry (this can be read from useTranslation(), i18n.language)

This changes based on what the user selected via the UI, while the browser settings
always remain the same.
@rolandgeider rolandgeider merged commit a0a956f into wger-project:master Jan 15, 2026
4 checks passed
@coveralls
Copy link
Collaborator

Coverage Status

coverage: 74.908% (-0.1%) from 75.026%
when pulling ef6224b on afzal09:send-selected-language-in-request-header-#1132
into 380641b on wger-project:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants