mirror of
https://github.com/serrebidev/BlindRSS.git
synced 2026-08-13 13:29:27 -07:00
Implement correct language markup in the rich full‑text view #55
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
serrebi/BlindRSS#55
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently, the rich full‑text view window displays content marked as English, regardless of the actual language of the article. This causes accessibility issues for users relying on assistive technologies — screen readers may attempt to read non‑English content using English speech synthesizers, apply English Braille translation tables, or use English character names. Additionally, text rendering may be affected (e.g., incorrect text direction for right‑to‑left languages).
Preconditions
Steps to reproduce
Actual behaviour
Expected behaviour
The rich full‑text viewer must correctly identify and apply the appropriate language markup (
langattribute in HTML) based on the following priority order:If BlindRSS performs automatic translation of the content:
If the original web page specifies a language:
langattribute of the<html>tag of the source page.If full text extraction fails and the viewer displays feed content:
xml:langattribute on the article container (if available).<language>.If no language is specified in the source page or feed:
Technical notes
langattribute (e.g.,<html lang="ru">for Russian).xml:langattribute for description tag.<language>element at the feed or article level.langattribute is correctly applied to the root element (or relevant container) of the HTML rendered in the rich full‑text viewer.Suggested solution
langattribute in the HTML output of the rich full‑text viewer.Largely fixed in v1.107.0, but two of the four rules are not fully live and I want to be precise about which, rather than close this as done.
Root cause
Not a wxPython issue — ours. The rich view is built on
wx_accessible_webview, whose constructor takeslang: str = "en". We never passedlang, so every article got the library's default. That's the hardcoded English you found.What's fixed
Rule 4 (UI language fallback) — the document root now gets BlindRSS's active UI language instead of
"en". Note this reports what's actually on screen: if you pick a language with no catalog, it resolves toen, because English source strings are what you'd be reading. Claiming otherwise would be lying to the screen reader.Rule 2 (source page
<html lang>) — read from the page before cleaning (the cleaner discards<html>), and applied. A page declaringlang="ru"now renders<article lang="ru">.Rule 3b (feed
<language>) — feeds now carry alanguagecolumn, filled on refresh.feedparsersurfaces both RSS<language>and Atom feed-levelxml:langasfeed.language, so both work. NULL means "never declared", which is a real answer distinct from a default — it's what lets rule 4 fall through correctly. The write isCOALESCE'd so a conditional GET can't erase a known language.Where the
langgoes: on<article>, not<html>. The webview skeleton is built once and reused for every article, so the root can't follow per-article language. Your issue explicitly allows "the root element or relevant container", andlangon an ancestor applies to its whole subtree, so content is announced correctly either way.The resolver refuses to guess: an unusable value (
"","unknown", junk) falls through to the next source rather than becoming a badlang. A wrong tag is worse than none — it actively points assistive tech at the wrong synthesizer.What's not live, and why
Rule 1 (translation target) — implemented and tested, but currently unreachable: automatic translation never runs in the rich view at all.
_translate_rendered_text_if_enabledis only called from the plain-text full-text worker, not from_rich_load_worker. So there's no translated content in the rich view to mark. Rule 1 presupposes behaviour that doesn't exist — that's arguably a separate bug (rich view + translation enabled = untranslated article), and probably deserves its own issue. Happy to file it.Rule 3a (per-item
xml:lang) — the resolver accepts and prioritizes it, but nothing populates it. Storing per-article language needs anarticles.languagecolumn, andarticleshas ~46 SELECT sites with explicit column lists. The channel language covers the common case; per-item override only matters for genuinely multilingual feeds. Left as a follow-up rather than rushed.Miniflux caveat — the Miniflux API exposes no feed language field, so rule 3 yields NULL on that backend and resolution falls through to rules 2 and 4. Rules 2 and 4 work on every backend, so the reported symptom is fixed regardless.
Worth a look with your screen reader to confirm it behaves as you expect.
I tested it on version 1.107.0 and everything seems to work as expected.
Limitations of translation and multilingual feeds are understandable and not a high priority.
The current implementation covers the vast majority of scenarios.
Thank you!
Thanks for confirming, and for the detailed original report — the
langplacement and the feedparser language facts in it are what made the fix straightforward.Agreed on the limitations. Per-element language markup for genuinely multilingual feeds would need language detection per block, which is a much bigger change for a much smaller set of cases; if a concrete feed ever makes it painful in practice, please open a new issue with the URL and we can revisit.
Closing as fixed in v1.107.0.