[Bug]: HTTP Header Accept-Language is not properly considered for the Setting Language: System default #1789

Closed
opened 2026-02-28 19:54:38 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @xthiago on GitHub (Jan 23, 2025).

Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

The Context:

Users can specify in their browser a list of preferred languages with a prioritization sorting (from the most preferred into to the less preferred).

Example from Brave (Chrome based):

Image

When requesting pages/resources, the browser sends to the server the user's choices in the HTTP Header Accept-Language MDN Reference with the sorting index (q).

Accept-Language: en-US, en;q=0.9, pt-BR;q=0.8

In Actual we have a Language setting called System default which relies on in Accept-Language header to provide to the user the UI in the preferred language (if available):

Image

The Issue:

The Language: System default setting only works when the browser sends a single language in the Accept-Language header. If we specify a list of choices, Actual always uses the English fallback.

Instead, Actual should check each language that user provided (from most preferred to less) and try to match to an available translation. Only fallback to English when none translation is found.

How can we reproduce the issue?

How can we reproduce the issue?

You can rely on the browser's built-in language preferences, but I suggest the installation of a browser extension that allows you to quickly switch/change the languages list for better DX. It could be any. I use Locale Switcher (Chrome, Firefox, GitHub).

Building the scenario:

I suggest you to first check the list of available languages:

Image

And then set the following preferable languages list:

  1. a language without Actual translation
  2. a language with Actual transaction
  3. another language with Actual translation

Image

accept-language: es, pt-BR;q=0.9, nl-NL;q=0.8

For 2 and 3 avoid English because that's the default/fallback choice.

Then access the Actual Web UI.

Expected result: you must see the UI in the second language(pt-BR in my case) because it has a translation and is more preferable than the third choice (Netherlands).

Current result: you will see the UI in English (fallback).

I found the issue while testing the PR https://github.com/actualbudget/actual/pull/4211#issuecomment-2607759277.

Where are you hosting Actual?

https://edge.actualbudget.org/budget

What browsers are you seeing the problem on?

Chrome

Operating System

Windows 11

Originally created by @xthiago on GitHub (Jan 23, 2025). ### Verified issue does not already exist? - [x] I have searched and found no existing issue ### What happened? ### The Context: Users can specify in their browser a list of preferred languages with a prioritization sorting (from the most preferred into to the less preferred). Example from Brave (Chrome based): ![Image](https://github.com/user-attachments/assets/7d2e89bd-a4b1-4aa2-bf9e-e9622d9fe3b7) When requesting pages/resources, the browser sends to the server the user's choices in the HTTP Header `Accept-Language` [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language) with the sorting index (`q`). ``` Accept-Language: en-US, en;q=0.9, pt-BR;q=0.8 ``` In Actual we have a `Language` setting called `System default` which relies on in `Accept-Language` header to provide to the user the UI in the preferred language (if available): ![Image](https://github.com/user-attachments/assets/d1526e68-f231-4a95-b3d4-c073690615ec) ### The Issue: The `Language: System default` setting only works when the browser sends a single language in the `Accept-Language` header. If we specify a list of choices, Actual always uses the English fallback. Instead, Actual should check each language that user provided (from most preferred to less) and try to match to an available translation. Only fallback to English when none translation is found. ### How can we reproduce the issue? **How can we reproduce the issue?** You can rely on the browser's built-in language preferences, but I suggest the installation of a browser extension that allows you to quickly switch/change the languages list for better DX. It could be any. I use **Locale Switcher** ([Chrome](https://chromewebstore.google.com/detail/locale-switcher/kngfjpghaokedippaapkfihdlmmlafcc), [Firefox](https://addons.mozilla.org/en-US/firefox/addon/locale-switcher/), [GitHub](https://github.com/locale-switcher/locale-switcher)). **Building the scenario:** I suggest you to first check the list of available languages: ![Image](https://github.com/user-attachments/assets/a5dcab98-ddf5-4b07-b1f2-90b84639d291) And then set the following preferable languages list: 1. a language without Actual translation 2. a language with Actual transaction 3. another language with Actual translation ![Image](https://github.com/user-attachments/assets/49e81f90-a2d5-490d-b3c6-42db596f5e87) ``` accept-language: es, pt-BR;q=0.9, nl-NL;q=0.8 ``` For 2 and 3 avoid English because that's the default/fallback choice. Then access the Actual Web UI. **Expected result:** you must see the UI in the second language(pt-BR in my case) because it has a translation and is more preferable than the third choice (Netherlands). **Current result:** you will see the UI in English (fallback). I found the issue while testing the PR https://github.com/actualbudget/actual/pull/4211#issuecomment-2607759277. ### Where are you hosting Actual? https://edge.actualbudget.org/budget ### What browsers are you seeing the problem on? Chrome ### Operating System Windows 11
GiteaMirror added the translationsgood first issuebug labels 2026-02-28 19:54:38 -06:00
Author
Owner

@xthiago commented on GitHub (Jan 23, 2025):

  1. Edge case to cover in tests: Language variations with/without country/region variant.

Image

pt-BR, pt-AO;q=0.9, pt;q=0.8
  1. To consider/think:

For a person who only has pt-BR in their browser, let's assume that Actual don't have a translation for
pt-BR.. maybe showing a pt or even a different regional translation like pt-pt, pt-AO is preferable than showing the fallback (English).

@xthiago commented on GitHub (Jan 23, 2025): 1. Edge case to cover in tests: Language variations with/without country/region variant. ![Image](https://github.com/user-attachments/assets/4b4294be-f4d3-4b3e-b494-07b975e438b0) ``` pt-BR, pt-AO;q=0.9, pt;q=0.8 ``` 2. To consider/think: For a person who only has `pt-BR` in their browser, let's assume that Actual don't have a translation for `pt-BR`.. maybe showing a `pt` or even a different regional translation like `pt-pt`, `pt-AO` is preferable than showing the fallback (English).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#1789