fix: prioritize English language selection for Guest user despite additional browser language settings

Description:
- Resolved an issue where the system incorrectly activated a non-English language for Guest users, even when English was the primary language in the browser settings.
- The bug occurred when additional languages (e.g., Arabic) were configured in the browser and one of those languages was already enabled in Frappe.
- Ensured that English is prioritized as the default language for Guest users when it is present in the browser language list, regardless of other enabled languages.
- Added a fix to explicitly enable English language for Guest users to prevent unintended language switching.

Steps to Reproduce:
- Create a new clean site and add additional languages (e.g., Arabic) in the browser settings.
- Ensure the additional language (e.g., Arabic) is already enabled in the database, which is by default.
- Observe that the system switches to the non-English translation (e.g., Arabic) for Guest users, even if English is the primary language in the browser settings.

Root Cause Analysis:
- Initially suspected `translate.py` was involved in language resolution.
- Checked enabled languages at the console using:
  `frappe.get_all("Language", filters={"enabled": 1}, pluck="name")`
  Result: ['fr', 'fa', 'es', 'de', 'ar']
- Identified that English was not enabled in the system, despite being a default requirement.
- Traced the issue to `languages.csv`, where English was not included among the enabled languages.

Fix:
- Enabled English in `languages.csv` to ensure it is included among the supported languages.
- This ensures English is chosen when included in the browser settings, resolving the issue.
This commit is contained in:
Sattam 2025-03-11 04:02:40 +03:00 committed by GitHub
parent 721af96f04
commit a88f2a8fc5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,7 +11,7 @@ cs,Čeština,0
da,Dansk,0
de,Deutsch,1
el,Ελληνικά,0
en,English,0
en,English,1
en-GB,English (United Kingdom),0
en-US,English (United States),0
eo,In-Context Translation,0

1 language_code language_name enabled
11 da Dansk 0
12 de Deutsch 1
13 el Ελληνικά 0
14 en English 0 1
15 en-GB English (United Kingdom) 0
16 en-US English (United States) 0
17 eo In-Context Translation 0