GNOME Bugzilla – Bug 149886
RTL support - panel contents order should be reversed ?
Last modified: 2015-03-24 13:00:56 UTC
From Fedora: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=108111 When changing Locale to Arabic, the GNOME Menu still showing on the left hand side not on the right hand side as it should be. Sounds like we should reverse the order of everything in RTL locales. Mailing gnome-i18n for input.
Arafat, Gil, should the panel be reversed in RTL locales as described here?
Yes. There are few things that have to be reversed, but there are other that shouldn't. I'll give some examples: The menus and toolbars (also on the panel, I'll get to it later) should be reversed and be displayed from right-to-left. But there are some things that shoud stay LTR! like the icons themselves (MS is reversing the images, it's a very big mistake...), arrow buttons (like in media players, because than you'll get something like: >> > || < << instead of: << < || > >>) or english text fields (like address bars in browsers). If I got it right, this problem is after launching GNOME first time in english, than the panel is created ordered as LTR, but when changing to arabic or hebrew the panel isn't re-generating and ordering the applets right-to-left. If Gnome is first-time started in hebrew (or arabic) the panel will be generated RTL, and everything will be fine. That's why it isn't really a bug, and I beleive that Gnome is doing a good job when it comes to RTL support.
Wanted to report this bug too ;) I agree with Gil, still I think the "emplacement" of every icon should be reversed too, the pixmaps themselves shouldn't, normally arrow buttons should be reversed too, but in the special case Gil is mentioning that does not make sense. But take a look at RB in RTL mode and compare it to LTR and you'll understand what I mean... I think RTL support in gnome is not really good... I reported many many bugs and I'm still discovering each week some new ones! So ok we've reached some point of support that's for sure but it is not #really# good...
We shouldn't reverse pixmaps by the software. If, for any reason, we should use a different pixmap, we should specify a new pixmap that compatible with RTL, So we won't accedently reverse arrows that we shouldn't or pixmaps that contains any text (for example, the fonts control panel icon).
For "vertical pixmaps" like the volume pixmap you can simply reverse from one side to the other, for "horizontal pixmaps" like the redo/undo pixmaps you have to draw new icons!
The problem of RTL layouts need super extra care. You may want to take a look at my slides at http://behdad.org/download/Presentations/bidi-layouts/ (the slides apparently don't tell the whole story, but may be helpful.) I think before just smashing things around, we need to reach to a consensus on how this all is supposed to be implemented. You can't just mirror ANY icon, since, for example, the theme used may be simply shadowed! If I make it to GNOME Summit 3 next month, I plan to discuss this with interested people. There's also the bidi.info project trying to figure out these things. In the long term, we can all just follow their recommendation ;-).
Great slides Behdad! At Arabeyes (www.arabeyes.org) we are working on the AIG : Arabization interface guidelines, I hope this will be ready in the near future so that we can submit to every interested hacker/community the paper to help them in recoding to rtl languages.
Guys: I might be wrong, but I think the bug is about the placement of objects on the panel. E.g: suppose I have this in LTR: ----------------------------------------------------- MenuBar Launcher WindowList ----------------------------------------------------- Then (if I understand the bug correctly), in RTL, we should have: ----------------------------------------------------- WindowList Launcher MenuBar -----------------------------------------------------
does it use gtkhtml? it seems that the english words get aligned right to left under rtl but the Arabic words get aligned from left to right under rtl!!! This bug is very famous in gtkhtml...
uh wrong posting excuse me, yes Vincent it should be like that!
BTW Arafat, that behavior is the alignment behavior of Gtk+. See my slides, it's in there.
Vincent, yes, packing from right to left is fine IMO.
It's high priority for RTL users. Let's try to have this for 2.14. (Using 2.12.x milestone for now because I don't have the 2.14 milestone yet ;-))
yeah the poor rtl users #really# need this... my desktop and panel look so ugly and mixed up under Arabic locale...
Arafat, Why don't you or one of the Arabeyes guys take a look at it then? The fix should be as small as one line of change I guess.
I'm not a hacker, sure if I was I would take immediately care of it... I'll ask some Arabeyes ppl about it!
Hamed was talking to me about this today. CC-ing him.
I took a look at the gnome-panel code, there is a gconf key named panel_right_stick that interpret the position of objects relative to the right (or bottom if vertical) edge of the panel. It's originally specified from the left. What we need is to reverse its value when we are in RTL locales. It can be done in two ways: 1. changing the code (applet.c I guess) to set the object position based on the locale. Seems not difficult. 2. Adding a script similar to what we have in gnome-panel SRPM that change the panel_right_stick value in RTL locales. It can be a xslt file affecting on schemas files. This is a simple job too. I've tested this in my own machine by changing all panel_right_stick values below the apps/panel node: $ gconftool-2 --dump /apps/panel > temp1.entries $ correcting the temp.entries using xslt or a simple script. $ gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --load temp.entries
Thanks Hamed, I believe we need the approach numbered 1, not 2. All calcuations etc are intact, only draw the applets at a different position...
*** Bug 311462 has been marked as a duplicate of this bug. ***
Mass changing: milestone 2.12.x => milestone 2.14.x
This is still an issue with 2.16.0. I run Ubuntu Edgy with Hebrew Locale and still experience the problem - this is a major consistency issue for the Hebrew user - and since the panel is one of the first things you see, it could deter the newbie from using GNOME. This bug is confirmed and marked as medium importance in Ubuntu: https://launchpad.net/distros/ubuntu/+source/gnome-panel/+bug/49898.
I believe that a similiar code that changes the position of the applet object as the panel_right_stick should be added. We should not use or alter panel_right_stick itself, but add more code that change the position based on the RTL property. This way if panel_right_stick is set, then in RTL mode the applet would be positioned to the left. Open question: Should this logic be applied to horzinal panels? However, this change won't fix all issuses with RTL panel. For example, look at the windows list applet. This applet does not support LTR. in LTR, windows are still added to the right of the the seperator (they should be added to the left), and the windows are hardly visible since the applet miscalculates its available size on the panel. The gnome-panel bug should be solved together with bidi bugs on gnome-applets.
Oops, i was wrong about the location of windows in the windows applet. But miscalculating available panel size is still in tact.
Created attachment 78188 [details] [review] right flip panel applets positions when in RTL locale This patch will right flip the applets position when running in an RTL locale. I've tested both packed and normal modes. The flip is done for both vertical/horzinal panels.
btw, if for some reason (which i can't think of myself) some rtl group does not wish this behavior, it is possible to add a message to the translation file to control it.
It might be better to deal with this in another bug, but the flipping is not desired in vertical panels.
Created attachment 78303 [details] [review] right flip panel applets positions when in RTL locale right flip panel applets positions when in RTL locale (better coded then previous patch)
Created attachment 78304 [details] [review] right flip panel applets positions when in RTL locale and panel orientation is horizontal This patch only flip positions for horizontal panels
The patch doesn't seem to do anything for me.
I've tested the latest patch (78304) and it works perfectly for me. Can someone else try it too?
The horizontal only patch is troublesome. The applet positions are determined when the panel loads the applets. When changing the panel oriention from hotizontal to vertical (e.g Top to Left), the applets positions are not flipped back (this seems the right behavior). And now, if you log out and back in, the applets positions are flipped. So the panel looks different before and after the re-login. A possible solution to this is to recalculate the applets positions when changing the panel orientation. However, i think that for the sake of the panel look consistency, changing orientation should look similiar for both rtl and ltr locales. Therefor, i believe is better to right flip applets positions for both horizontal and vertical panels.
Both current patches (78303 78304) are not good enough. the calculation used (rtl_pos = panel_size - pos) is not correct. For example: |YYY XXX| would be converted to: | XXX YYY| A better position calculation could be: rtl_pos = panel_size - pos - applet_size; but, i don't think that when doing this calculation the applet_size is known. moreover, this means that the applets positions must be updated if the applet size is changed. An even better solution is to not modify the position field in the applet, and calculate the rtl position before setting the applet position in the panel GtkFixed container, and giving the GtkFixed container the rtl position. still, the applet size must be taken into consideration when calculating the rtl position. Figuring the applet size may continue to be an issue. (No, i'm not a gtk expert). Maybe there is a need for a GtkRtlFixed container where the widgets positions are fixed with the exeption of mirroring the container when in rtl direction?
I was about to report this bug until I found this one. This is really a serious issue and a stopper for newbies. We're planning a big Arabic release for gnome-2-18 and we'd love to contribute whatever we can to see this resolved. Trying the patches...
Just confirming that the patch works "good enough" for Arabic. True it doesn't take into account the size of the applet, but that's not a deal breaking problem IMO. Can we have this applied on trunk?
I'm almost finished working on the improved solution which will be a complete solution. it's still have a really minor issue so it'll take few more days before the patch is ready.
Created attachment 80200 [details] [review] rtl locale - display applets from right to left on horizontal panels Finally, this should end the issue. Applets will be displayed from right to left, taking their width into consideration. This patch also solve the issue described in comments #23 and #24. This is HIGH importance CRITICAL bug for RTL locales, and should be included in the 2.18 release.
Can someone test the patch please?
Behdad: dude, I can't read farsi and you can, so it's probably better that you (and not I) test it ;-) Does the patch work on panel that are not extended? It seems to me like it wouldn't. Also, I'd need to look, but there's the right_stick setting that needs to work. Maybe it will just work, though. I'm also not sure about the change in panel_widget_get_cursorloc(). It looks to me like it could break some stuff like drag and drop (when dropping a launcher on the panel, eg).
s/extended/expanded/ in my comment :-)
Patch applied and does what's intended visually. I haven't tested in vigorously with drag and drop etc (will). But just to make sure, what are non-expanded panels? I thought all panels extend 100% to available space, horizontal or vertical.
Djihed: in the panel properties dialog, it's the first checkbox.
The patch would work in packed panels. The code added is inside an if statement for non packed panels.
Tested dragging items, dragging new launchers from the desktop and the menu and creating new applets. Works as expected. Tried both rtl and ltr. Expanding-retracting works as long as the applets are locked. Otherwise some misarragements may occur. However, I've seen the same behaviour from a vanilla panel.
But its seems that there should be more code to handle packed panels. Packed panels are not reversed for me.
You're right. When the panel is packed in rtl mode, applets get positioned in ltr order, which shouldn't happen.
Created attachment 80322 [details] [review] rtl locale - display applets from right to left on horizontal panels Same as previous patch. Also works for packed panels. Also fix position of new applets inserted with the "Add to panel" dialog.
Hamed, Roozbeh, can you guys test too?
(In reply to comment #48) > Hamed, Roozbeh, can you guys test too? > I have tested it. There are some points: 1. The latest patch does not compile for me. The last part of patch which omit the brace is unneeded. 2. There are still a problem with packed panel. When I switch to packed panel, in RTL mode, right_stick applets goes beside the menu applet in the right. 3. Hidden button moving should be reversed too. Now, when I click on right hidden key, it moves the panel to the left and vice verse.
Hamed, I didn't understand the problem in 2., Can you attach a screenshot?
Also, IMHO, we should drop the right stick key. It never did what it was intended to do.
(In reply to comment #50) > Hamed, > > I didn't understand the problem in 2., Can you attach a screenshot? > Do as follow: * Change the panel to packed mode in RTL locale. * Logout. * Login in RTL locale. I will attach a screenshot.
Created attachment 80361 [details] Packed Panel in RTL locale
Created attachment 80365 [details] [review] rtl locale - display applets from right to left on horizontal panels Same as previous patch. Fix compilation error, and fix the panel being hidden in the opposite direction of the hidden button.
I've just tested issue 2. in comment #49. I've tested on a vanilla gnome-panel and in english locale, and i have the same results. So this is a general bug in gnome-panel which does not relates to my patch.
(In reply to comment #51) > Also, IMHO, we should drop the right stick key. It never did what it was > intended to do. This is not an option right now, I'm sorry. (although I agree that it's the right thing to do in the long term). And note that maybe there's nothing to do for it to work in RTL environments. One more comment about the patch: you're using spaces instead of tabs in some places. And I still need to take some time to look at some of the changes in this patch.
I'd better shed some light on this patch. The idea behind this patch is to just display the applets from right to left. Meaning that the position 0 in the panel is the right most point in it. The benefit of this approach is that there are almost no changes required in the panel logic. 1) Since GTK displays widgets from left to right, when passing an applet its location in the screen, we have to subtract its width. 2) Since position 0 is the right most point. when clicking in the mouse on this point, we don't care that the mouse was clicked in (9999,0) coordinate, we care that it was clicked in position 0 in the panel. This is why the change in panel_widget_get_cursorloc() is required. without this change, DnD and moving applets in the panel would be broken.
Created attachment 80740 [details] [review] rtl locale - display applets from right to left on horizontal panels Use tabs instead of spaces
Patch is in. I'm not sure it fixes all RTL issues, but I can't tell. Testing it with a new user would be nice to make sure it works by default ;-)