The permission titles are not translated, though the label in front of the checkbox is. The patch fixes this.

Comments

BarisW’s picture

Title: Checkbox titles on the permissions page is missing t() function » Checkbox titles on the permissions page are missing the t() function
Issue tags: +Accessibility

The screenshot may not be totally clear. What you are seeing is the Dutch translated interface. All content, labels etc are translated, except for the descriptive title. This means that screenreaders have to read mixed English and Dutch - not pretty.

My patch uses the variable that is already used to create the labels on the left of the checkboxes.

Everett Zufelt’s picture

Priority: Normal » Major

Thanks for catching this.

Can you please be more descriptive about what is not being translated? I am a screen-reader user and therefore cannot see the image. Also, I can certainly tell why the current code is broken, can you please explain how your line fixes the problem so that I don't have to figure that out myself?

BarisW’s picture

Hi Everett! Of course, I'll try.

The point with the current setup is that the label in front of every row is nicely translated. Every checkbox has it's own title as well, which consist of a combination of the role and the label.

For example, the first checkbox on the row with the label 'adminster blocks' has the title 'anonymous user: administer blocks'.

If we translate this page into Dutch, the label translates to Blokken beheren, which is Dutch for Administer blocks. The titles on the checkboxes however translate to anonieme gebruiker: administer blocks, which is a combination of Dutch for the role and English for the permission.

This happens because the User module uses another variable for the row label than it does for the checkbox labels. My code just replaces the variable that is used for the checkbox label by the one that is already used for the row label.

Here is the current (translated HTML code):

  <tr class="even">
    <td class="permission">
      <div class="form-item form-type-item" id="edit-administer-blocks">Blokken beheren</div>
    </td>
    <td class="checkbox">
      <div class="form-item form-type-checkbox form-item-1-administer-blocks">
        <label for="edit-1-administer-blocks" class="element-invisible">anonieme gebruiker: administer blocks</label>
        <input type="checkbox" class="form-checkbox" value="administer blocks" name="1[administer blocks]" id="edit-1-administer-blocks">
      </div>
    </td>
    <td class="checkbox">
      <div class="form-item form-type-checkbox form-item-2-administer-blocks">
        <label for="edit-2-administer-blocks" class="element-invisible">geverifieerde gebruiker: administer blocks</label>
        <input type="checkbox" class="form-checkbox" value="administer blocks" name="2[administer blocks]" id="edit-2-administer-blocks">
      </div>
    </td>
    <td class="checkbox">
      <div class="form-item form-type-checkbox form-item-3-administer-blocks">
        <label for="edit-3-administer-blocks" class="element-invisible">administrator: administer blocks</label>
        <input type="checkbox" class="form-checkbox real-checkbox" checked="checked" value="administer blocks" name="3[administer blocks]" id="edit-3-administer-blocks">
        <input type="checkbox" checked="checked" disabled="disabled" class="dummy-checkbox" title="Dit toegangsrecht is geërfd van de rol 'geverifieerde gebruiker'." style="display: none;">
      </div>
    </td>
  </tr>

So the problem occurs at the part where the role and the permission are combined in the title of each checkbox, seperated by a semicolon. I hope this makes any sense. If not, I'm more happy to explain more.

Everett Zufelt’s picture

+1

Thanks, makes sense and looks good.

Everett Zufelt’s picture

Title: Checkbox titles on the permissions page are missing the t() function » Checkbox titles on the Permissions page not properly translating

Changing title

bowersox’s picture

This patch looks good to me. It would be great to get a second opinion just to make sure #markup can be re-used in this way. Here is the 1-line change:

-        $form['checkboxes'][$rid][$key]['#title'] = $roles[$rid] . ': ' . t($key);
+        $form['checkboxes'][$rid][$key]['#title'] = $roles[$rid] . ': ' . $form['permission'][$key]['#markup'];
Everett Zufelt’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Quick fix

+1 simple fix.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)
Issue tags: -Quick fix, -Accessibility

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