[Mailman-i18n] RTL and BiDi

Barry A. Warsaw barry@python.org
Tue, 8 Oct 2002 14:42:01 -0400

>>>>> "MvL" =3D=3D Martin v L=F6wis <loewis@informatik.hu-berlin.de> wr=

    >> Near as I can tell, this looks great to me in Moz 1.1.

    MvL> I think Arash is pointing out that the first paragraph
    MvL> right-adjusts in the Window, whereas the second paragraph
    MvL> left-adjusts.

    MvL> If you could read Farsi, you would probably also notice that
    MvL> the order of words is incorrect in the second paragraph,
    MvL> since the first word is on the left end of the line, so if
    MvL> you read RTL, you start in the middle of a sentence
    MvL> (depending on where your browser breaks the lines).

I see that now, thanks.  Boy, Martin, I didn't know you read Farsi
too! :)

    MvL> In the first paragraph, all is fine: the first word is on the
    MvL> right end of the first line, and stays there no matter how
    MvL> you resize the window. This is caused by the dir=3D"rtl" of th=
    MvL> P element.

    MvL> So, in short, you do need the dir attribute - the browser
    MvL> does not automatically set the directionality of the
    MvL> paragraph.

    MvL> For Mailman, this means you need to augment all templates
    MvL> appropriately - I guess this is usually done on the <html>
    MvL> tag.  If you ever generate the HTML tag without a
    MvL> customization hook (e.g. as in htmlformat.Document.Format),
    MvL> then this might cause a problem: you will need to inject
    MvL> "DIR=3D'RTL'" there somehow. Alternatively, you'll have to mov=
    MvL> the dir attribute further down, to, say, TITLE and BODY.

The templates should be easy, since you'd just add those to the fa
version.  Here's a sketch of what Arash might want to hack together
for htmlformat.Document.Format():

- Add a dictionary to Defaults.py.in called LC_DIRECTIONS, where the
  key is a language code and the value is a flag.  I don't want to
  change the interface for LC_DESCRIPTIONS.

- Add a function to Utils.py that returns the direction for a given
  language code by looking up the language in LC_DIRECTIONS.  The
  default should be LTR so if there's no key in the dict, it's LTR.

- Add the appropriate dir attribute to the appropriate tag in Format()
  based on the lookup.  You probably should not add a dir attribute
  for LTR.

That may be all you need, although check the archiver for other places
where <html> might be hardcoded.