i'm playing with my theme and make it RTL'ized... and found some more issues in core. Some might say this can solved directly in the theme, but i think this should be corrected in core with language negotiation - so i don't need to hack/workaround them in the theme.
theme.inc
function theme_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
return '<div class="breadcrumb">'. implode(' » ', $breadcrumb) .'</div>';
}
}
As you can see here the implode(' » ', $breadcrumb) insert an arrow in the wrong direction. this should be solved in core.
Additional - i currently don't know why - but my breadcrumbs are not turned to RTL in my theme... but all other text is... maybe a CSS bug, but could be the order in the $breadcrumb variable.
Comments
Comment #1
hass commentedI'm not sure, but i think this text cannot be RTL'ized with CSS... it needs a change in HTML, isn't it?
Comment #2
gábor hojtsyWell, if RTL people say that the breadcrumb needs to be reversed on an RTL page, then yes you need to use a reversed arrow and an array_reverse() in the breadcrumb theme function.
Comment #3
hass commentedTake a look on http://www.drupal.org.il/ (looks currently down !?)... but yesterday i saw - they reverse the items and the arrow... maybe later the day they are back online and we can see it again.
Comment #4
hass commentedpatch reverses the order and uses «
Comment #5
hass commentedresulting HTML code is:
<div class="breadcrumb"><a href="/drupal6/index.php?q=admin/settings" title="Adjust basic site configuration options.">Site configuration</a> « <a href="/drupal6/index.php?q=admin">Administer</a> « <a href="/drupal6/">Home</a></div>Comment #6
mooffie commentedFortunately, we don't need to do this characters swapping ourselves. When the browser sees the "arrow pointing right" character in RTL context (e.g. between two Hebrew words) it automatically swaps it with the "arrow pointing left" character.
This process is called "mirroring" and is done auotmatically by the browser (by any decent bi-directional application).
Arrows are not the only characters that undergo mirroring. Others are brackets, quotation marks, "less than", etc.
(But thanks for being so thoughtful! :-)
Comment #7
hass commented@mooffie: What's about the item ordering? Shouldn't this reversed? Only changing the "arrow" won't help much, while there is also the "Home" link located on the "left" and not "right" as required for RTL!??
I will try to get such a browser for my German box :-).
Comment #8
hass commentedreopen this for your "radar"...
i tried to use Firefox Portable 2.0 with HE language pack installed... there is nothing swapped :-(. What browser can is use?
Comment #9
mooffie commentedNo, it shouldn't be reversed. It's fine. The browser rearranges it if needed.
Although Hebrew/Arabic is _displayed_ from right to left, it is _stored_ (in the computer memory; in files) in order. "Stored in order" means that the first letter, the first word, is stored before the second letter, the second word. That's why it's OK that in your source file "Home" comes before "Admin" and "Admin" comes before "Site configuration". Note that this is also _semantically_ correct. When these strings are in Hebrew the browser understands that it should display the characters (and thus the words themselves) from right to left.
Oh, any GUI browser nowadays will do (FF, Opera, Safari, Konqi, IE).
You don't need additional packs. These packs only translate the GUI interface (menus, dialogs, etc). You don't need them to _view_ Hebrew/Arabic/Japanese/Russian in your pages.
Any browser nowadays is capable of displaying Hebrew/Arabic --and almost any other language in the world-- out of the box.
Of course, you only need to find a way to sprinkle some RTL characters in your pages. Don't bother configuring your keyboard: a simple cut&paste will do.
Now,
Look:
Home » Administration
בית » אדמיניסטרציה
The second line is a translation of the first. Note the arrow. If you copy it (the last one; the one pointing left) and paste it somewhere you'll see that it's actually pointing right (surprise!). The two arrows are the one and the same character (when stored in memory; not when shown on screen, of course).
Comment #10
mooffie commentedBTW, that's why it's better to name this character by its semantics, "arrow pointing forward", and not by its presentation, "arrow pointing right"; because the presentation may change. Semantics doesn't change.
Similarly, the "(" is better named "opening parenthesis", not "left parenthesis".
In the past it was suggested to introduce semantic CSS properties and attributes: 'margin-start' and 'margin-end'. Compare this with the current 'margin-left' and 'margin-right', which are presentational --and which therefore force us to bundle Drupal with yucky 'something-rtl.css' files.
Comment #11
gábor hojtsyThanks for educating people! :) This is very much appreciated. And it also makes this issue "by design".
Comment #12
hass commentedGREAT, thank you very much for this good explanation and the example... however i wonder how the browser can be such intelligent *G*.
Aside is there any good reference for LTR people to better understand, what needs to be reverted in CSS and what not? Maybe we can add this to the handbooks, too? I learned from the RTL patches for core, but being save in understanding is somewhat better then trial-and-error without deep understanding. I reverted margin-(left/right)'s, border(left/right)'s, paddings and so on and so on. Everything that was not layout specific and therefor text based has been reverted with CSS... it looks ok for me - but i could be wrong :-)