View Full Version : More arabic/english stuff...text direction?

03-12-2003, 03:30 PM
well i figured unicode was the way to go here (http://www.codingforums.com/showthread.php?s=&threadid=15594). Not supported by every single browser out there but good enough for the majority.
BUT i'm now having text direction probs.:(
Here's the issue.
I have arabic text that SHOULD appear like so:

they're two different words, each in a different color (just to clarify).

now, because Arabic is a right-to-left language, i should probably be adding dir:rtl to my stylesheet.

which I did. i've got a table in which some of the text is arabic and some english, within the same cell. wherever it's arabic it's in a span with dir:rtl.
It doesn't work.

If I change the whole page and add dir:rtl to the entire body's style, then it works. But I can't do that because the entire page goes right to left, including table formatting, english, and everything. so that's why i specified this only in my "ar" span for arabic text:


Why doesn't it work?:confused:

Instead of showing as it ought to, it ends up with the words in the wrong order, like this:
the text is supposed to say "don't beat", but instead it says "beat don't"...

Roy Sinclair
03-12-2003, 04:10 PM
I think you're real close to what you want, the problem with using <span> is that it isn't a block level element and I believe the "dir" applies at the block level. Try using <div> instead of span.

03-12-2003, 08:26 PM
i tried it. still not working :(.

03-12-2003, 09:08 PM
it's working!!:D:D
it didn't work with <p> or <table> or <div> or any block level element, the only thing it worked with was <body>. i think that might be because i'm not just using plaing html with "dir", i'm also using Unicode encoding.

so i used <BDO dir="rtl">....</BDO> within a span or div and it worked as i wanted it.:)

but i'm not sure if this is really the most appropriate way to do it?

03-12-2003, 09:36 PM
ASAAKI, you don't have to resort to that! :D
You missed one bit in the spec. You also need a little 'bidi-override' (which corresponds to the HTML element BDO... :p)

Try this:

.multi span { unicode-bidi: bidi-override; direction: rtl }

<p class="multi">
There was <span>a lady</span> of Venice <span>who used</span> hard-boiled eggs <span>to play</span> tennis.</p>

03-13-2003, 01:33 AM
krycek applauds :thumbsup:

::] krycek [::

03-19-2003, 02:30 PM
ok i've taken a while to reply here..
i tried the tennis lady thingie:D, it did work, thanx meow:).
just a couple of quick questions.
why shouldn't i use BDO? is it a 'bad' thing to do? deprecated or something?
about bidi-override... is it compatible with earlier browsers?

03-19-2003, 02:53 PM
No, neither BDO nor dir are deprecated to my knowledge.

Don't take my word for this now. I have never actually used this, just played around with it. According to my modest testing neither method work in Opera or Netscape 4. Both methods work in IE (at least 5 up) and Moz. So why not choose CSS? It feels like "the right thing to do" and it would be way more flexible. You can just dump class="baclwards-language" where you want it and type away. :D

Uhm. Don't know about Mac and nix browsers.

03-25-2003, 10:14 PM
Originally posted by meow
Don't know about Mac and nix browsers.
I have both - if you whip up a test page I'll be happy to check it out.

03-26-2003, 03:01 AM
Sure, whip-whip (http://w1.181.telia.com/~u18115332/bidi-override.html)! :p

03-26-2003, 05:14 PM
Linux - works in Moz but not Konqeuror (3.0.3)

Mac tests coming later (when I get home)

03-26-2003, 09:43 PM
Mac - only mozilla worked ... ie5 and safari didn't

03-27-2003, 12:24 AM
Not the standard text either? Or just not the hover thing?

IE5 Win handles the ordinary backwards lines, but not the hover.

03-27-2003, 12:28 AM
then would be it better to simply use the BDO element?

03-27-2003, 12:41 AM
Not on Windows. The support seems to be the same for both methods. The hover was just for fun. :D

Have to ask brothercake about Mac browsers.

03-27-2003, 01:17 AM
Well the behaviors were the same that I tested - either they both worked or neither.

Do you have a <bdo> demo page? I can check that out.

03-28-2003, 01:14 AM

03-28-2003, 09:01 PM
That one worked in mac/ie5, mac/ie4 and safari

It also worked in every version of Opera (I tried 3.51 - 7 on windows and 5-6 on mac)

It also worked on netscape 3 and 4 ...

then mozilla, on both windows and mac, works in very early builds - moz0.6 / netscape 6.01 fine - but by 6.1 it had stopped working, and doesn't in any later builds.

Dunno .. maybe from that you could build a hybrid element, like

<bdo dir="rtl" class="bdo">

Now I check, the CSS bidi-override only works in modern mozilla builds, not in the earlier ones which supported <bdo>, and the <bdo> doesn't work in win/IE6 either, so it looks like there's no overlap - if you use that element with the attached CSS (and it works like that), you should get pretty much universal coverage.

03-29-2003, 07:31 AM
except that it does work in ie6/win? it works with me.
anyhow thanks:)

ps. you might be amused to know that my 7-yr old sister's so impressed by your site that she's been wanting to have her own 'sistercake.com' site since last year, 'if only copycats weren't an uncool thing :('.

03-29-2003, 07:44 AM
:confused: Wait, wait... brothercake, did you view source? The text is supposed to get garbled if it works... :p

It sure doesn't work in Netscape 4 on Windows and Opera (Win) doesn't support either method, not even 7.

03-29-2003, 09:57 AM
Originally posted by meow
:confused: Wait, wait... brothercake, did you view source? The text is supposed to get garbled if it works... :p
Oh ... hmm; right. Well I guess just read the opposite of what I said then :rolleyes: Sorry ....

ASAAKI - that's very sweet :D

03-29-2003, 03:18 PM
It sure doesn't work in Netscape 4 on Windows and Opera (Win) doesn't support either method, not even 7.

Oh ... hmm; right. Well I guess just read the opposite of what I said then Sorry ....
drats! just when i thought i could forget about this problem now.
so, what exactly does all that equate to? :confused: bdo hardly works anywhere, and bidi-override only works on the modern browsers...?

03-29-2003, 07:59 PM
LOL @ brothercake, you had me really confused there.

I was on my way to bed and just had to start all damn browsers and try again. I may have to kill you now. :D