subissue from #2004176: [META] Unify Content, String and Configuration Translation UI for accessibility, usability & responsivness, for unify from #2003834: Accessibility fixes

  • Add lang="" attribute to String Translation UI Elements
  • Add Language Name in Brakets to hidden Text for Screenreaders in String Translation UI
Files: 
CommentFileSizeAuthor
#28 2004684-string-translation-ui-accessibility-28.patch4.73 KBmgifford
PASSED: [[SimpleTest]]: [MySQL] 57,997 pass(es).
[ View ]
#25 2004684-string-translation-ui-accessibility-25.patch4.74 KBmgifford
PASSED: [[SimpleTest]]: [MySQL] 57,973 pass(es).
[ View ]
#18 2004684-string-translation-ui-accessibility-18.patch4.72 KBmgifford
PASSED: [[SimpleTest]]: [MySQL] 57,691 pass(es).
[ View ]
#9 Screen Shot 2013-06-04 at 11.54.04 PM.png148.94 KBmgifford
#1 2004684-string-translation-ui-accessibility-1.patch3.97 KBSchnitzel
FAILED: [[SimpleTest]]: [MySQL] 57,639 pass(es), 1 fail(s), and 0 exception(s).
[ View ]

Comments

Schnitzel’s picture

Status:Active» Needs review
StatusFileSize
new3.97 KB
FAILED: [[SimpleTest]]: [MySQL] 57,639 pass(es), 1 fail(s), and 0 exception(s).
[ View ]

first patch

  • Adds lang="" attribute to source and translation elements
  • shows "Translated string (German)" for screenreaders, not only "Translated string"
  • also handling Plural forms which did not yet had the Source/Translation hidden element (!)
Schnitzel’s picture

Status:Needs review» Needs work

The last submitted patch, 2004684-string-translation-ui-accessibility-1.patch, failed testing.

falcon03’s picture

@Schnitzel: thanks for opening this issue. These fixes sound really great. I'll review the patch as soon as possible.

BTW, the patch failed testing, unfortunately. Do you think it can be reviewed in any case?

Schnitzel’s picture

@falcon03

yes you can review the patch, the failing test is only a tiny little thing, which will not change any of the structure of the HTML.

thanks!

mgifford’s picture

I just scanned through the code, but it looks good. I'll leave @falcon03 to do the testing, but happy with the changes I've seen.

We don't need this in the patch either:

old mode 100644
new mode 100755

Anyways, happy to see this was caught.

Gábor Hojtsy’s picture

Eagerly awaiting testing feedback! :) Thanks!

Gábor Hojtsy’s picture

Issue tags:+D8MI, +sprint, +language-interface
mgifford’s picture

StatusFileSize
new148.94 KB

Set this up:
admin/config/regional/translate/translate

View with patch for better string translation

Looks good except that there's a label without a form element on this page:

<label class="element-invisible" for="edit-strings-1-original">Source string (Built-in English)</label>
<span lang="en">Show all columns</span>

This probably should be a new issue though as it's really unrelated to the initial reported error.

Gábor Hojtsy’s picture

@mgifford: well, the "Source text..." text is a regular form item #type, this is just how Drupal renders those (and those don't have a form element in general). Its the same before/after the patch also. Any other accessibility feedback or should this be ready to go once green?

mgifford’s picture

No, it should be good when it's green. I reviewed the code and it's adding good text changes and semantic ones too.

Will have to hunt down the label separately. Labels need to be associated with form elements strictly in a 1 to 1 relationship.

mgifford’s picture

Issue tags:+language of parts

tagging.

mgifford’s picture

Status:Needs work» Needs review
Issue tags:-accessibility, -D8MI, -sprint, -language of parts, -language-interface

Status:Needs review» Needs work
Issue tags:+accessibility, +D8MI, +sprint, +language of parts, +language-interface

The last submitted patch, 2004684-string-translation-ui-accessibility-1.patch, failed testing.

Gábor Hojtsy’s picture

Issue tags:+language-ui
mgifford’s picture

I think the test is failing here:
    $this->assertNoText('English', t('No way to translate the string to English.'));

But not sure why it's failing as that text seems to exist in the source on /admin/config/regional/translate/translate

Source string (Built-in English)

Would like to get the test fixed.

Gábor Hojtsy’s picture

@mgifford: before the patch, the source language name did not show in the UI. The test is asserting it DOES NOT show, and now it shows. So fails. The intent of that assert is to test if English shows up as an option in the "Translation language" select box. It does not show there, but it shows now on every page as part of the source string description.

So one quick fix would be to do something like:

<?php
$this
->assertNoRaw('>English<', t('No way to translate the string to English.'));
?>

Or if there is some specific method to check for an option existing in a select dropdown. Or if you want to pull out your xpath skills and do an assert xpath on the source to look for an option tag that has 'English' as text, those would be fancier. :)

Can you push this that little forward? Sounds like we are pretty close!

mgifford’s picture

Status:Needs work» Needs review
StatusFileSize
new4.72 KB
PASSED: [[SimpleTest]]: [MySQL] 57,691 pass(es).
[ View ]

I tried the quick fix you expressed. Hopefully the bot likes it.

Status:Needs review» Needs work
Issue tags:-accessibility, -D8MI, -sprint, -language of parts, -language-ui, -language-interface

The last submitted patch, 2004684-string-translation-ui-accessibility-18.patch, failed testing.

Gábor Hojtsy’s picture

Status:Needs work» Needs review

Status:Needs review» Needs work
Issue tags:+accessibility, +D8MI, +sprint, +language of parts, +language-ui, +language-interface

The last submitted patch, 2004684-string-translation-ui-accessibility-18.patch, failed testing.

Gábor Hojtsy’s picture

'Exception' with message 'The configuration directory type staging does not exist.' does not seem to be related to this patch at all :)

Gábor Hojtsy’s picture

Status:Needs work» Needs review
Gábor Hojtsy’s picture

Status:Needs review» Needs work

Ok, so this proves it works now :) Let's get in a real test assertion on it :)

I think something like this is more fancy to say the thing we are looking for to not be there:

<?php
$this
->assertNoOption('edit-langcode', 'en', t('No way to translate the string to English.'));
?>

This expresses that the edit-langcode select list does not have an 'en' option. More foolproof than just asserting for >English<. I just had time to look up this more fancy way, I don't easily recall the assert methods I don't regularly use :) Sorry for not coming with this option first :)

mgifford’s picture

Status:Needs work» Needs review
StatusFileSize
new4.74 KB
PASSED: [[SimpleTest]]: [MySQL] 57,973 pass(es).
[ View ]

Filenames changed too. Thanks Gabor. Here's the new patch.

Gábor Hojtsy’s picture

Status:Needs review» Reviewed & tested by the community

Looks all good to me as long as it passes :)

effulgentsia’s picture

Status:Reviewed & tested by the community» Needs work
+++ b/core/modules/locale/locale.pages.inc
@@ -345,6 +347,8 @@ function locale_translate_edit_form($form, &$form_state) {
+              '#prefix' => $i == 0 ? ('<span class="element-invisible">' . t('Translated string (@language)',  array('@language' => $langname)) . '</span>') : '',

Here and elsewhere, the class name needs to be changed, because of #1363112: Simplify names of "element-x" helper classes.

mgifford’s picture

Status:Needs work» Needs review
StatusFileSize
new4.73 KB
PASSED: [[SimpleTest]]: [MySQL] 57,997 pass(es).
[ View ]

Annoying.. Where's the search/replace on all existing patches to update strings like that.....

Thanks effulgentsia!

Gábor Hojtsy’s picture

Status:Needs review» Reviewed & tested by the community

All righto!

Dries’s picture

Status:Reviewed & tested by the community» Fixed

Committed to 8.x. Thanks!

Gábor Hojtsy’s picture

Issue tags:-sprint

Woot, thanks @falcon03, @Schnitzel, @mgifford!

Status:Fixed» Closed (fixed)
Issue tags:+sprint

Automatically closed -- issue fixed for 2 weeks with no activity.

Gábor Hojtsy’s picture

Issue tags:-sprint

Yay!