Issue metadata
Sign in to add a comment
|
No language indicated in markup on chrome://accessibility |
||||||||||||||||||||||||
Issue descriptionGoogle Chrome 70.0.3524.2 (Official Build) dev (64-bit) Firmware Version Google_Lulu.6301.136.57 Navigate to chrome://accessibility and either inspect or look at source code Expected: <html lang="en"> Actual: No language markup
,
Aug 31
,
Aug 31
,
Aug 31
Note I can find lots of examples of <html> within chrome/browser/resources chromium/src/chrome/browser/resources$ git grep -ni '^<html>$' | wc -l 48 and only a few specifying a lang hromium/src/chrome/browser/resources$ git grep -ni '^<html lang' | wc -l 8 I may try fix up more of them as a follow-up commit.
,
Aug 31
patch for chrome://accessibility uploaded at https://chromium-review.googlesource.com/c/chromium/src/+/1198706
,
Aug 31
Although some pages specify
<html lang="$i18n{language}">
is this preferable? or is lang="en" sufficient? (chrome does both)
,
Aug 31
the 4th option appears to be <html i18n-values="dir:textdirection;lang:language">
,
Aug 31
Generally the approach in #7 is preferred, but test that it works in a page that isn't localized like chrome://accessibility.
,
Sep 3
Thanks for that michaelpg I have updated https://chromium-review.googlesource.com/c/chromium/src/+/1198706 to only add lang="en" to pages which do not include any i18n references (e.g. they have no evidence of internationalization). I will try do a follow-up commit to address pages which are internationized.
,
Sep 3
I'll also try test those pages in case it 'just works'
,
Sep 3
Huh, michaelpg for the win.
lang="$i18n{language}" works on accessibility.html
Even removing 'all' the js includes still leaves it working, so it looks like this is done before the page is 'served' (not sure what that means in this context).
Awesome, I'll update the patch.
,
Sep 3
the alternative <html i18n-values="dir:textdirection;lang:language"> only works when we include https://cs.chromium.org/chromium/src/ui/webui/resources/js/i18n_template.js as this is the js that uses i18n-values to then populate the other attributes (dir, lang, i18n-processed).
,
Sep 3
Can I ask why |lang| is important in WebUI?
,
Sep 3
lang is important for screen readers.
If a page is only available in English and a user is using a screen reader in Spanish, it may try to pronounce the page using Spanish readings of the English words.
Setting the lang correctly to "en" should instead make it read the page correctly in English (in theory).
So it seems that the templates of the form "$i18n{key}" are replaced by
https://cs.chromium.org/chromium/src/ui/base/template_expressions.cc?q=%22$i18n%22&sq=package:chromium&dr=C&l=61
and seem to be initially populated by
https://cs.chromium.org/chromium/src/ui/base/webui/web_ui_util.cc?q=%5C%22language%5C%22&sq=package:chromium&dr=C&l=179
If I set a garbage key like
<html lang="$i18n{BEEP}">
then when I load the page (chrome://accessibility) I see the error
[106213:106242:0903/125950.096984:FATAL:template_expressions.cc(97)] Check failed: value != replacements.end(). $i18n replacement key "BEEP" not found
which comes from
https://cs.chromium.org/chromium/src/ui/base/template_expressions.cc?q=%22$i18n%22&sq=package:chromium&dr=C&l=97
,
Sep 3
Michael are you able to elaborate on why the js i18n-values is preferred and if there is any good documentation on it?
,
Sep 3
For static html pages (pages without any obvious internationalization support) I think using the lang="en" is likely the safest. My concern is that using any of the other two options will set the lang to the user's preference, even when the page itself is not available in that language. I can try test this to confirm.
,
Sep 4
i18n-values is an older method that requires the JS template processor to be included. It sets the |dir| attribute, which is important for right-to-left languages, but you can also get that with:
<html dir="$i18n{textdirection}" lang="$i18n{language}">
So I think the tl;dr is:
On untranslated pages (mainly internal pages), use <html lang="en">
On translated pages, use
<html dir="$i18n{textdirection}" lang="$i18n{language}">
,
Sep 7
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e808b4f74f0fa65c8f45ccc0489a8dfa128e84b8 commit e808b4f74f0fa65c8f45ccc0489a8dfa128e84b8 Author: Chris Hall <chrishall@chromium.org> Date: Fri Sep 07 03:40:03 2018 Specifying lang="en" on English-only WebUI accessibility page. Bug: 877724 Change-Id: Iaa71eda0e0fa94f9d23c9bc71b12d2abd3ec4224 Reviewed-on: https://chromium-review.googlesource.com/1209001 Commit-Queue: Chris Hall <chrishall@chromium.org> Reviewed-by: Alice Boxhall <aboxhall@chromium.org> Cr-Commit-Position: refs/heads/master@{#589425} [modify] https://crrev.com/e808b4f74f0fa65c8f45ccc0489a8dfa128e84b8/chrome/browser/resources/accessibility/accessibility.html
,
Sep 14
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/98192dac000a6762dbba673a4dba180006e749fa commit 98192dac000a6762dbba673a4dba180006e749fa Author: Chris Hall <chrishall@chromium.org> Date: Fri Sep 14 00:58:44 2018 Specifying lang="en" on English-only WebUI pages. Bug: 877724 Change-Id: I5321f253513f369db9f3ed54758785ca84cfb2cf Reviewed-on: https://chromium-review.googlesource.com/1198706 Commit-Queue: Chris Hall <chrishall@chromium.org> Reviewed-by: Alice Boxhall <aboxhall@chromium.org> Reviewed-by: Michael Giuffrida <michaelpg@chromium.org> Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org> Cr-Commit-Position: refs/heads/master@{#591244} [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/about_invalidations.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/bluetooth_internals/bluetooth_internals.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/chromeos/cryptohome.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/chromeos/drive_internals.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/chromeos/sys_internals/index.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/chromeos/zip_archiver/unpacker-test/cpp/index.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/eoc_internals/eoc_internals.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/inspect/inspect.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/interventions_internals/unsupported_page.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/local_state/local_state.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/media/media_engagement.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/omnibox/omnibox.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/sandbox_internals/sandbox_internals.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/supervised_user_internals.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/task_scheduler_internals/index.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/usb_internals/usb_internals.html [modify] https://crrev.com/98192dac000a6762dbba673a4dba180006e749fa/chrome/browser/resources/user_actions/user_actions.html
,
Sep 14
and that should be us \o/
,
Nov 16
|
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by leberly@chromium.org
, Aug 25