Skip to content

Enhance language selection and detection with pagination fixes#632

Merged
fho4abcd merged 4 commits into
ABCD-DEVCOM:masterfrom
rogercgui:minor-repairs-opac
Apr 18, 2026
Merged

Enhance language selection and detection with pagination fixes#632
fho4abcd merged 4 commits into
ABCD-DEVCOM:masterfrom
rogercgui:minor-repairs-opac

Conversation

@rogercgui
Copy link
Copy Markdown
Member

Users have reported a number of issues, mainly regarding language selection, since version 3.6.0.

Replace the old <select> language picker with a Bootstrap-style dropdown menu and add scoped CSS for hover/active states. Keep existing URL GET parameters when changing language by outputting them as hidden inputs in a small form (id=changelanguage) and submit that form on selection; default to "en" if the requested lang folder is missing. Also add HTML-escaping for injected values, assign ids to hidden lang input and form, and simplify the JS submission via onclick handlers. This improves UX and preserves user context when switching languages.
Replace the previous simple language selection with a robust detection flow: dynamically scan opac_conf for installed languages, prefer explicit ?lang in URL, then session/cookie, then browser Accept-Language, then central session, and finally opac_gdef or English as fallback. Adds setcookie and session/request synchronization, verifies language folders exist before selecting, and provides a safety default list if the directory scan fails (e.g. due to permissions). Removes the old priority logic and final directory validation in favor of the new consolidated selection process.
Add a safeguard when paginated results are empty (e.g. due to bots) by checking resultados_pagina_atual[0]['base'] and falling back to a safe default base. Standardize and correct several comments (Portuguese→English), fix quote characters, update changelog entry, and adjust some user-facing default strings to English fallbacks. Also clarify dictionary/truncation logic comments and minor wording tweaks; no major behavior changes beyond the pagination safety check and messaging/comment cleanup.
Comment out the error_log call that recorded attempts with unknown request parameters to reduce log noise (or avoid exposing data). The handler still blocks the request by terminating execution when an invalid parameter is detected. The line has not been removed, as it may be useful for debugging.
@fho4abcd fho4abcd merged commit 5367ff0 into ABCD-DEVCOM:master Apr 18, 2026
@rogercgui rogercgui deleted the minor-repairs-opac branch April 19, 2026 14:51
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.

2 participants