-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Sync UI language selection with user profile settings #14151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
f8aa5cc
e970bc6
3ddfae9
04d14be
da06037
109886d
80b537e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -851,6 +851,7 @@ | |
| "django_user_agents.middleware.UserAgentMiddleware", | ||
| "geonode.base.middleware.MaintenanceMiddleware", | ||
| "geonode.base.middleware.ReadOnlyMiddleware", # a Middleware enabling Read Only mode of Geonode | ||
| "geonode.base.middleware.ProfileLanguageMiddleware", | ||
| ) | ||
|
|
||
| MESSAGE_STORAGE = "django.contrib.messages.storage.cookie.CookieStorage" | ||
|
|
@@ -1486,6 +1487,9 @@ def get_geonode_catalogue_service(): | |
| ("it-it", "Italiano"), | ||
| ) | ||
|
|
||
| # This setting includes supported Maptstore language choices in a DB-based format | ||
| PROFILE_LANGUAGE_CHOICES = tuple((code.split("-")[0].lower(), label) for code, label in MAPSTORE_DEFAULT_LANGUAGES) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can't we use the get_2letters_languages utils with some changes?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mattiagiupponi thanks for the comment. Ini my opinion, the idea in this setting is to completely be synced with the Mapstore supported languages. I'm afraid that if we use / modify this method, we will add a bit of complexity and it will not such clear that the source of truth here is the supported Mapstore language. |
||
|
|
||
| if os.getenv("LANGUAGES"): | ||
| # Map given languages to mapstore supported languages. | ||
| LANGUAGES = tuple( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To fully synchronize the UI language selection with the user profile as intended, the selected language should be persisted to the user's profile when they are authenticated. This ensures the preference is preserved across different sessions and devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would change the semantics of the topbar switcher from a session-only override to a persistent profile update. So I will keep the current approach.