virtaal icon indicating copy to clipboard operation
virtaal copied to clipboard

Wrong direction of RTL text in the editing box

Open transl8bzimport opened this issue 14 years ago • 9 comments

Version: 0.5.2

Originally posted by Usama Akkad:

Hi, thanks for this really useful tool

every thing in the program seems ok with RTL.

  1. strings are showing as RTL if it's RTL text
  2. if string doesn't start with English letter then no problem

the problem: if some string starts with LTR letter then the whole string shows from LTR in the editor box and that make it hard to translate with all those <> around

example:

This is the list of defined filters. They are processed top-to-bottom.

Click on any filter to edit it using the controls in the right-hand half of the dialog.

هذه لائحة من المرشحات المعرفة، لقد عولجت من الأعلى إلى الأسفل.

إنقر على أي مُرشح لتحريره باستخدام المتحكمات في النصف الأيمن من الصندوق.

it's hard to read. as you see part of the problem is those and

marks. and it get more complicated if there is more of those marks.

Possible Solutions:

  • make the editor ignore those special purpose thing like

    and and similar in rendering the direction

  • let all the strings in RTL language show in RTL direction in the editor
  • create special key to render the display from LTR and RTL and vice versa, which is very important and could be the sole fix or a necessity for the above possible fixes.

workaround: user may add RTL letter to the beginning of the text and remove it after finishing

transl8bzimport avatar Apr 29 '10 03:04 transl8bzimport

Originally posted by Usama Akkad:

Created attachment 642

screen-shot

transl8bzimport avatar Apr 29 '10 03:04 transl8bzimport

Thank you for reporting this. We've been aware of the issue, but it is unfortunately very hard to fix with the current technology we use. The behaviour is determined by the Unicode bidirectional algorithm and the way it is implemented in GTK. Unfortunately we can't force the alignment to be towards the right in the editing area. To ignore the tags will only be possible if we replace them entirely with widgets and make them not contain any text. This would make it harder to edit tags (in the rare cases where you maybe need to edit an attribute), but at this time it seems to be the best solution. This will require a lot of work, so I'm not sure if it will happen soon.

I really want Virtaal to be the best environment for editing RTL, and I think we're doing well, but still have issues like these to sort out.

friedelwolff avatar Apr 29 '10 14:04 friedelwolff

Originally posted by Usama Akkad:

thank you for your efforts, is it possible to have shortcut key to switch the direction like in firefox there is Ctrl+Shift+x

it works in all editing boxes

transl8bzimport avatar Apr 29 '10 14:04 transl8bzimport

I am not aware of a way to do that with GTK (the platform for Virtaal). Khaled, do you know of any GTK applications that do this?

friedelwolff avatar Apr 29 '10 17:04 friedelwolff

(In reply to BZ-IMPORT::comment #4)

I am not aware of a way to do that with GTK (the platform for Virtaal). Khaled, do you know of any GTK applications that do this?

Me either, and I don't think GTK can do this (GTK's TextArea doesn't allow overriding text direction, if it did then we would have fixed the issue long ago :). Qt, however, doesn't even change the base direction of paragraphs and leaves it to every application to do implement it (and may don't), but they allow toggling the base direction using alt-shift keys (the right ones toggle sets RTL and vice versa) and Windows does so.

I think the best solution here is to lobby gtk developers to make TextArea's base direction overridable, then we get the best of both worlds.

khaledhosny avatar Apr 29 '10 19:04 khaledhosny

Friedel, what about a stupid hack like inserting RLM at the beginning of the buffer and then removing it when the unit is closed?

khaledhosny avatar Apr 29 '10 19:04 khaledhosny

We can do something like an RLM at the start, but do we then just blindly remove it when the user leaves it? How will we know if the user actually wanted it there? Dwayne suggested adding some padding of invisible control characters so that we know that we added it there, but then those characters are also in the clipboard if the user selects and copies.

friedelwolff avatar Apr 30 '10 17:04 friedelwolff

Can't we use text tags to tag the added mark non-editable?

khaledhosny avatar May 01 '10 06:05 khaledhosny

It sounds possible, but still leaves the problem that "select all + copy" will give the user more than they planned to get.

friedelwolff avatar May 19 '10 16:05 friedelwolff