After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 514479 - Provide commandline option or environment variable to choose RTL/LTR
Provide commandline option or environment variable to choose RTL/LTR
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-02-05 08:47 UTC by Luca Ferretti
Modified: 2014-07-20 06:02 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24


Attachments
Patch adding GTK_DIRECTION environment variable (1.30 KB, patch)
2008-02-07 15:53 UTC, Luca Ferretti
none Details | Review
A beautiful gedit in Italian RTL (29.18 KB, image/png)
2008-02-07 15:54 UTC, Luca Ferretti
  Details
Updated patch, using GTK_FORCE_DIRECTION (1.11 KB, patch)
2008-02-07 20:17 UTC, Luca Ferretti
needs-work Details | Review
Updated patch (2.56 KB, patch)
2009-08-02 18:01 UTC, Luca Ferretti
needs-work Details | Review

Description Luca Ferretti 2008-02-05 08:47:36 UTC
Sometimes LTR developers could need to check the layout of their application in RTL locale (and vice versa).

By now the only way to do this is launch the application setting LANG and LANGUAGE to a RTL locale. This is suboptimal 'cause:
 * you have to know what locale is RTL
 * you have to install locale (on some distro like Ubuntu)
 * you can't use the application if you don't know the language :-)

So, could be interesting provide a command line option like --gtk-reverse-direction or --gtk-direction=[ltr|rtl], or an environment variable like GTK_REVERSE_DIRECTION or GTK_DIRECTION=[ltr|rtl] in order to mirror the window layout keeping current locale.

Example: gedit --gtk-direction=rtl

Result:
 
    |           Help Documents Tools Search View Edit File |
    |------------------------------------------------------|
    |  Paste Copy Cut | Redo Undo | Print | Save vOpen New |

(note vOpen is Open with the arrow button).


Additional info:
This feature should ideally propagate to Glade UI designer, providing View -> RTL/LTR radiomenuitems to switch the layout of the UI you are creating.
Comment 1 Behdad Esfahbod 2008-02-05 12:28:27 UTC
Makes sense.  I'd go with the env var.  Got a patch?
Comment 2 Luca Ferretti 2008-02-07 15:53:27 UTC
Created attachment 104639 [details] [review]
Patch adding GTK_DIRECTION environment variable

Usage:

   GTK_DIRECTION=ltr|rlt <command>
Comment 3 Luca Ferretti 2008-02-07 15:54:25 UTC
Created attachment 104640 [details]
A beautiful gedit in Italian RTL
Comment 4 Behdad Esfahbod 2008-02-07 17:04:42 UTC
I'd go as far as naming it GTK_FORCE_DIRECTION.  Because it's not expected to be in use normally.
Comment 5 Luca Ferretti 2008-02-07 20:17:05 UTC
Created attachment 104666 [details] [review]
Updated patch, using GTK_FORCE_DIRECTION

Note: patch is against stable branch...
Comment 6 Behdad Esfahbod 2008-02-08 18:01:18 UTC
Patch needs some formatting help, but I can do that.

Matthias, can this go in?
Comment 7 Shaun McCance 2009-07-26 21:12:56 UTC
Whatever mechanism is used, I'd like to hook into that to test RTL processing of documents in Yelp.  If it's an envar, I can just check that easily.  If you do go with a command line option, I'd like some way to check for that.
Comment 8 Matthias Clasen 2009-07-26 21:28:17 UTC
I don't see the need, really. Personally, I always use LANG=he_IL.utf-8 for testing rtl issues. Why is that not sufficient for you ?
Comment 9 Shaun McCance 2009-07-26 21:45:03 UTC
I was just pointed to this bug by Milo when we were talking about testing RTL features in Yelp's document rendering.  For me, sometimes I might not even have an RTL-language translation of a document to test with.  Document translation lags behind interface translation considerably.  Of course, I can always just set xml:lang to something RTL on an English document.

I'm not going to push this.  I can always just do a Yelp-specific environment variable for testing.  I just figured if something was going to go into GTK+, I might as well use that.
Comment 10 Luca Ferretti 2009-07-26 21:56:49 UTC
(In reply to comment #8)
> I don't see the need, really. Personally, I always use LANG=he_IL.utf-8 for
> testing rtl issues. Why is that not sufficient for you ?
> 

Well, first you have to know that he_IL is RTL :)
Second, he_IL needs to be installed on your system.

Applying the patch, you will able to check RTL/LTR even if only C locale is installed. And for _all_ GTK+ applications.
Comment 11 Behdad Esfahbod 2009-07-27 18:45:13 UTC
It's hard for non-Hebrew speakers to navigate through the UI with LANG=he_IL.
Comment 12 Luca Ferretti 2009-08-02 18:01:33 UTC
Created attachment 139745 [details] [review]
Updated patch

Updated patch against current master branch, should fix indentation issues. Plus a stub of explanation in running.html

@Matthias: I used this patch to test some UIs, Behdad agreed to include it, Shaun said it could be really useful to test documentation, the patch itself doesn't cause any regression or performance issue, it simply adds a feature. I hope this doesn't sound rude, but your only point is that you use another - and tricky :) - method...
Comment 13 Matthias Clasen 2009-08-02 22:00:09 UTC
I don't want GTK to listen to an ever-growing set of random environment variables.
If you want this debug feature, make it a GTK_DEBUG key. That would give you the additional benefit of having it available as a commandline option.
Comment 14 Matthias Clasen 2014-07-20 06:02:21 UTC
the inspector offers an ltr/rtl switch in the ui now