GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Server mode: selected UI language doesn't persist beyond the request that set it · Issue #10347 · pgadmin-org/pgadmin4

Server mode: selected UI language doesn't persist beyond the request that set it #10347

New issue
Copy link
New issue
Copy link
Closed
Closed
Server mode: selected UI language doesn't persist beyond the request that set it#10347
Copy link
Labels
Bug

Description

@dpage
dpage
opened on Aug 26, 2026
Issue body actions

Describe the bug

In server mode, get_locale() (web/pgadmin/__init__.py:308-339) only resolves the correct language on the single request that includes a language field in the POSTed form (e.g. the login form, or the "Miscellaneous > User language" preferences save). On every other request it falls through to English, because its session/cookie fallback is broken:

data = request.form
if 'language' in data:
    language = data['language'] or language
    setattr(session, 'PGADMIN_LANGUAGE', language)
elif hasattr(session, 'PGADMIN_LANGUAGE'):
    language = getattr(session, 'PGADMIN_LANGUAGE', language)
elif hasattr(request.cookies, 'PGADMIN_LANGUAGE'):
    language = getattr(
        request.cookies, 'PGADMIN_LANGUAGE', language
    )
  • session (Flask's SecureCookieSession) and request.cookies (a MultiDict) are dict-likes, not objects that expose their keys as attributes. setattr(session, 'PGADMIN_LANGUAGE', language) sets a plain Python instance attribute that is never merged into the session's actual dict contents, so it's never serialised into the session cookie and doesn't survive past the current request object.
  • hasattr(request.cookies, 'PGADMIN_LANGUAGE') and the matching getattr(...) never succeed either, for the same reason — cookie values live in the dict, not as attributes.

Confirmed with a quick REPL check against flask.sessions.SecureCookieSession and werkzeug.datastructures.ImmutableMultiDict: both hasattr checks are always False, and the setattr value never appears in dict(session).

Net effect: elsewhere in the app (e.g. web/pgadmin/preferences/__init__.py:292-296 and web/pgadmin/browser/__init__.py:454-457) a PGADMIN_LANGUAGE cookie is correctly written to the browser via response.set_cookie(...), but get_locale() can never read it back on subsequent requests, so the UI silently reverts to English as soon as the request no longer includes the language form field.

To Reproduce

  1. Run pgAdmin in server mode with more than one configured LANGUAGES entry.
  2. Log in choosing a non-English language on the login page (or set a non-English language in Preferences > Miscellaneous > User language and save).
  3. Navigate to any other page / reload.
  4. The UI reverts to English rather than staying in the selected language.

Expected behavior

The selected language should persist for the session/browser (via the PGADMIN_LANGUAGE cookie that is already being set correctly elsewhere) across requests, not just the one request that submitted it.

Suggested fix

Read the cookie/session properly, e.g.:

elif 'PGADMIN_LANGUAGE' in session:
    language = session.get('PGADMIN_LANGUAGE', language)
elif 'PGADMIN_LANGUAGE' in request.cookies:
    language = request.cookies.get('PGADMIN_LANGUAGE', language)

and set the session value with session['PGADMIN_LANGUAGE'] = language rather than setattr.

Found while re-verifying #5692 (login page language selection) — the login page itself reads the cookie correctly via request.cookies.get(...) in login_user.html, but this get_locale() path is what governs the language of every other page, and it doesn't work.

Activity

  1. dpage
    added
    Bug
    on Aug 26, 2026
  2. dpage
    added 2 commits that reference this issue on Sep 23, 2026

    Fix UI language not persisting beyond the request that set it (server…

    This issue will close once commit a49911f is merged into the 'master' branch.
    a49911f

    Fix UI language not persisting beyond the request that set it (server…

    This issue will close once commit 6dacd6e is merged into the 'master' branch.
    6dacd6e
  3. dpage
    added 3 commits that reference this issue on Oct 12, 2026

    Fix UI language not persisting beyond the request that set it (server…

    This issue will close once commit a3c0ffd is merged into the 'master' branch.
    a3c0ffd

    Fix UI language not persisting beyond the request that set it (server…

    This issue will close once commit 01e5155 is merged into the 'master' branch.
    01e5155

    Fix the UI language not persisting beyond the request that set it in …

    This issue will close once commit 2a952d6 is merged into the 'master' branch.
    2a952d6
  4. dpage commented on Oct 12, 2026

    @dpage
    dpage
    on Oct 12, 2026
    ContributorAuthor
    More actions

    Fixed by #10351 (2a952d6).

  5. dpage
    closed this as completedon Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.