GNOME Bugzilla – Bug 514479
Provide commandline option or environment variable to choose RTL/LTR
Last modified: 2014-07-20 06:02:21 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.
Makes sense. I'd go with the env var. Got a patch?
Created attachment 104639 [details] [review] Patch adding GTK_DIRECTION environment variable Usage: GTK_DIRECTION=ltr|rlt <command>
Created attachment 104640 [details] A beautiful gedit in Italian RTL
I'd go as far as naming it GTK_FORCE_DIRECTION. Because it's not expected to be in use normally.
Created attachment 104666 [details] [review] Updated patch, using GTK_FORCE_DIRECTION Note: patch is against stable branch...
Patch needs some formatting help, but I can do that. Matthias, can this go in?
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.
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 ?
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.
(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.
It's hard for non-Hebrew speakers to navigate through the UI with LANG=he_IL.
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...
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.
the inspector offers an ltr/rtl switch in the ui now