RTL support

in Userscripts.org discussion
Subscribe to RTL support 7 posts, 3 voices



DMaster Scriptwright

hi Jesse..
i know you've been sick lately (hope you'r feeling better by now..)
i wanted to ask..
is it possible to add RTL support ?
im israely.. and hebrew (and all the arabic dialects) are written in right-to-left (RTL).
its very disturbing to read on the opposite side..
is there any way you can help with this ?

p.s..
i dont know if its known (outside the RTL circles)..
but inorder to switch sides you need to press:
R-CTRL+R-SHIFT inorder to align to the right
L-CTRL+L-SHIFT inorder to align to the left
it works on every text editor (you might want to try on MS-word).. but not here..

 
Jesse Andrews Admin

DMaster, does it work on most websites? Do you know what I need to do to add RTL support? Is it adding a tag/attribute to html? If you can point to scripts/styles/html/websites/tutorials I'd be glad to add it.

I'm feeling better now, thanks!

 
DMaster Scriptwright

i dont know a thing about how to make it in a webpage..
israely website: AMD Ultra Game

<p align="right">Shalom</p>
this should make the text align to the right like so:
Shalom, whats up ? שלום, מה קורה
** i only added alot of tab chars inorder to show how it should look like..

 
Marti Scriptwright

This should point in the right direction...

CSS Style (i18n DTD sold separately ;) )
<el style="direction: ltr;">
  <p style="direction: rtl;">This text should be right to left.</p>
  <p>This text should be left to right.</p>
</el>

Attribute support
<el xml:lang="en-US" lang="en-US" dir="ltr">
  <p xml:lang="he" lang="he" dir="rtl">This text should be right to left and of course in Unicode (שלום, מה קורה).</p>
  <p>This text should be left to right.</p>
</el>
See also:
http://www.w3.org/International/articles/language-tags/
http://www.w3.org/International/questions/qa-css-lang
 
Jesse Andrews Admin

I think I already support the DIR attribute. If not there is a bug. Does this mean there isn't an issue?

 
Marti Scriptwright

Jesse Andrews wrote:
I think I already support the DIR attribute. If not there is a bug. Does this mean there isn't an issue?

Example tests:

שלום, מה קורה

rtl

שלום, מה קורה


It's not stripping out the dir attribute, but it's also not formatting... lemme try in html direct.

Works in HTML direct in the browser but appears not to on uso
<html>
  <head></head>
  <body>
    <table style="width: 100%;">
      <tr>
        <td>
          <p dir="rtl">This text should be right to left.</p>
        </td>
      </tr>
    </table>
  </body>
</html>

The CSS theme might have something to do with it too...

Test rtl


HTML filter is stripping out the style attribute in the source.

Maybe the parent table is overriding it?

I just tacked on a "display: block" into my sample and it "appears" to force it ltr in the browser.

Converted my table example to a div example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
  <head>
    <meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
  </head>
  <body>
    <div>
      <p dir="rtl" lang="he">שלום, מה קורה</p>
    </div>
  </body>
</html>
This keeps the text right aligned and in reverse... I can only assume that because the text was non Unicode in first example that's why it was displaying ltr... I don't read Hebrew, so I can't really tell for sure... but default example doesn't render Hebrew characters unless meta content tag is present... so I can tell that the text is reversing in the browser if I omit this.

So to make a long story short... something in the CSS in uso table or elsewhere is preventing it.

Confirmed table can do it, but have to force width to 100%
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
  <head>
    <meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
  </head>
  <body>
    <table style="width: 100%">
      <tr>
        <td>
          <p dir="rtl" lang="he">שלום, מה קורה</p>
        </td>
      </tr>
    </table>
  </body>
</html>
Going to stop on this now... Good luck.

 
Marti Scriptwright

screen.css

th, td, caption { margin: 0; padding: 0; border: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; text-align: left; font-weight: normal; vertical-align: middle; }
text-align: left on td element... remove it and then it works right... don't know what the repercussions are elsewhere though.

Probably safer just to add this to screen.css near the above CSS:
td { text-align: inherit; }

Temporary fix included in the uso - custom.css script.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel