[annotator-dev] annotator: RTL flag in i18n

Amir More habeanf at gmail.com
Mon Nov 14 22:37:00 UTC 2011


When there can be multiple annotations on the same line, there is an order
relation over them which defines the order of display in the margin.  The
order relation depends on the vertical and horizontal starting position of
the first highlight of the annotation.

When the text is RTL the horizontal position in reversed, so text
highlighted at the beginning of a sentence has a larger horizontal position
than a highlight on the same row later in the sentence.

The RTL flag should determine if the marginviewer sorts by
(vertical,horizontal) or (vertical,-horizontal).

Note that the vertical/horizontal position is determined by the container
of the highlighted text.. as opposed to the element containing the
annotation margin view.  So i'm not sure we want to require the use of an
annotator css style (which would require a specific class name for the dom
element containing the text).

We can use the direction attribute of the element containing the
highlighted text, however there may be unexpected side effects with
websites that don't use RTL.  There are many sites which unfortunately use
alignment attributes instead of the direction attribute.

I figured maybe the i18n would be a good place to put the flag but I agree
that it doesn't seem like a good fit.

In the mean time it's a constant in the marginviewer class.

On Fri, Nov 11, 2011 at 22:10, Nick Stenning <nick at whiteink.com> wrote:

> On Tue, Nov 8, 2011 at 21:28, Amir More <habeanf at gmail.com> wrote:
> > Hey Nick,
> > I pulled the merge of the i18n branch into the master.
> > I couldn't find anything in the locale or *.pot file indicating
> > right-to-left.
>
> Hmm, this is an interesting one. I don't think i18n should do anything
> special for RTL languages. You'll probably need to write an
> `annotator.rtl.css` or something like that though, which should set
> "direction: rtl;" on any/all Annotator elements.
>
> > While working on the marginviewer plugin I realized I need this flag for
> > sorting comment in the margin, when there are multiple comments on the
> same
> > line.
>
> Okay, if I were you I'd query the direction CSS property of the
> relevant element  (element.style.direction) to determine which way to
> sort.
>
> Does that make sense? I'm not sure I understand exactly what you're
> trying to do, but I don't think it needs to be a concern of the I18N.
>
> Best,
> Nick
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20111115/b4876c89/attachment-0002.html>


More information about the annotator-dev mailing list