This issue began life at #226587: Default sidebar region labels are confusing (wrong) for RTL languages.
Themes support RTL languages by loading additional style sheets where text alignment, float, margin, padding, and offset of elements can be overridden to reflect the LTR design as a RTL design. In the default themes, this has the unfortunate side-effect of putting the left sidebar region on the right hand side of the page for RTL users.
Both common sense and Bojhan have pointed out that users understand labels like "left sidebar" and "right sidebar" when thinking about layout more readily than abstract labels like "primary sidebar" and "secondary sidebar" or "first sidebar" and "second sidebar."
Developers of bidirectional or purely RTL themes may also have some "cognitive dissonance" when working in page templates, theme info files and elsewhere. Default themes use hardcoded region names like sidebar_left and sidebar_right. This issue does not address this problem. Template variable names and page region names are being discussed at #226587: Default sidebar region labels are confusing (wrong) for RTL languages.
This issue aims to improve the usability of the block admin UI in bidirectional and RTL contexts.
The proposed solution is to create a new theme settings array named 'bidirectional_regions' which defines comma separated pairs of regions whose labels should be exchanged when a RTL user works in the block admin form.
regions[sidebar_left] = left sidebar regions[sidebar_right] = right sidebar regions[content] = content regions[header] = header regions[footer] = footer bidirectional_regions[] = sidebar_left,sidebar_right
Additional pairs of bidirectional regions would look like this:
regions[sidebar_left] = left sidebar regions[sidebar_right] = right sidebar regions[content] = content regions[header_left] = left header regions[header_right] = right header regions[footer] = footer bidirectional_regions[] = sidebar_left,sidebar_right bidirectional_regions[] = header_left,header_right
The stored value of the block's region will remain normalized to LTR languages.
if user's language is LTR: $element['region'] = array( '#type' => 'select', '#options' => array( 'header' => 'header', 'sidebar_left' => 'left sidebar', 'sidebar_right' => 'right sidebar', etc... ), ); if user's language is RTL: $element['region'] = array( '#type' => 'select', '#options' => array( 'header' => 'header', 'sidebar_right' => 'left sidebar', 'sidebar_left' => 'right sidebar', etc... ), );
If themers want to use another method to support bidirectional layout (i.e. their theme uses tables for layout), they could also use the values of this 'bidirectional_regions' array in a preprocess function to swap the contents of the regions too. However, this issue is only concerned with the region labels that appear in the block administration UI.
If a themer uses semantic names for her regions, she can also omit the 'bidirectional_regions' settings from her theme info file to prevent the labels from exchanging places.
I have other patches to work on, but I will happily review patches and if I have time after terms-as-fields, I will do my best on this too.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | rtl-sidebars-nomenclature.patch | 713 bytes | tsi |
Comments
Comment #1
johnalbin+1 :-)
“bidirectional_regions” seems verbose, maybe just rtl_regions? Just thinking out loud; I'll have to think some more about this issue.
Comment #2
johnalbinHmm… Swapping region labels isn't going to work for themes that have only 1 sidebar or that have 2 sidebars on the same side. :\
The only solution I see is having an alternate RTL label per region.
What about one of these solutions?
As far as simplicity, #3 initially looks good. But I'm concerned that there's nothing in the example that explains why there are 2 labels. #4 suffers from this as well.
That's why I'm leaning towards #2.
Comment #3
johnalbinPushing to D8
Comment #4
tsi commentedComing here from #226587: Default sidebar region labels are confusing (wrong) for RTL languages
I believe (hope) that currently, without postponing this to D8, our best approach will be to get rid of left and right in the sidebars naming.
IMHO this kind of naming is unnecessarily restrictive, narrow minded and sometimes, as described in the original issue, buggy (in RTL sites for example). furthermore, I don't believe in the existence of that hypothetical site maintainer/Drupal user that will be so clueless to get confused by first/second sidebars - there will be much more RTL maintainers that will get frustrated when all the blocks they have just positioned in the right sidebar will show up on the left.
We accepted the idea that the sidebars should flip when switching to RTL !
We got rid of left/right in the theme level !
Why don't we take that last step ? instead we try to complicate even more by creating inconsistent sidebars names.
Comment #5
PixelClever commentedD7 is in code freeze, it is highly unlikely that issues that don't break a site are going to get in.
Comment #6
mgiffordDon't think the status should have changed.
Comment #7
Bojhan commentedYhea, no way lol. This is a terrible idea.