@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

a11y: Add lang attribute to <html> element

Summary:
https://www.w3.org/WAI/standards-guidelines/act/rules/b5c3f8/ and
https://dequeuniversity.com/rules/axe-devtools/3.1/html-has-lang
require a lang attribute. It is only possible to set one value.

If the user is logged in, set their "Translation" which they set on `/settings/panel/language/`, else set to English.

Disadvantage: The translation might be so incomplete that they'll stick get most strings in English while their screenreader software expects a different language.

Ref T16072

Test Plan:
Open a Phorge page logged in and logged out, look at its `<html>` header.
Change to a different "Translation" on `/settings/panel/language/`, repeat.

Reviewers: O1 Blessed Committers, chris

Reviewed By: O1 Blessed Committers, chris

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16072

Differential Revision: https://we.phorge.it/D26054

+9 -1
+9 -1
src/view/page/AphrontPageView.php
··· 65 65 $data_fragment = null; 66 66 } 67 67 68 + if ($this->hasViewer() && $this->getViewer()->isLoggedIn()) { 69 + $html_lang = phutil_safe_html(' lang="'. 70 + str_replace('_', '-', $this->getViewer()->getTranslation().'"')); 71 + } else { 72 + $html_lang = phutil_safe_html(' lang="en"'); 73 + } 74 + 68 75 $response = hsprintf( 69 76 '<!DOCTYPE html>'. 70 - '<html%s>'. 77 + '<html%s%s>'. 71 78 '<head>'. 72 79 '<meta charset="UTF-8" />'. 73 80 '<title>%s</title>'. ··· 76 83 '%s'. 77 84 '</html>', 78 85 $data_fragment, 86 + $html_lang, 79 87 $title, 80 88 $head, 81 89 $body);