Description of problem: Gtk internally uses the following check to decide whether to use RTL or LTR widgets direction: /* Translate to default:RTL if you want your widgets * to be RTL, otherwise translate to default:LTR. * Do *not* translate it to "predefinito:LTR", if it * it isn't default:LTR or default:RTL it will not work */ char *e = _("default:LTR"); if (strcmp (e, "default:RTL")==0) gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL); else if (strcmp (e, "default:LTR")) g_warning ("Whoever translated default:LTR did so wrongly.\n"); However, if an external tool/library wants to decide whether Gtk would use RTL or LTR, it needs to do the same check, e.g. (in Python): xlated = gettext.ldgettext("gtk30", "default:LTR") if xlated == "default:LTR": Gtk.Widget.set_default_direction(Gtk.TextDirection.LTR) else: Gtk.Widget.set_default_direction(Gtk.TextDirection.RTL) This is not a good solution as it depends on an internal implementation of the check used by the Gtk toolkit. If Gtk developers decide to change it or for example just change the particular string used for the check, such a solution will stop working. Version-Release number of selected component (if applicable): gtk3-3.9.14-1.fc20 Actual results: No function providing information about the default widget direction exported by the Gtk library. Expected results: A function hiding the internal implementation. Additional info: I understand this information is quite rarely needed, but there are some applications that make use of it (e.g. the Anaconda installer).
Created attachment 798660 [details] Possible (untested) patch
use gtk_widget_get_text_direction
(In reply to Matthias Clasen from comment #2) > use gtk_widget_get_text_direction I wish I could. Output from testing in the installer: > gtk_widget_get_default_direction tells: LTR > the right direction: RTL The problem is that Gtk is initialized before language is chosen in the installer and the value returned by the gtk_widget_get_text_direction function uses some cached value. So, either there has to be a function to get the right (current) value, or gtk_widget_get_text_direction has to be modified to return the right (current) value. Since I have no idea what side effects the latter solution could have, I proposed a patch implementing the former one.
I misunderstood the problem. There is indeed not good way to do this sort of reinitialization right now, short of looking at the 'special' translations yourself. I'll look at adding a gtk_get_locale_direction() to the API for 3.12, then you can use that instead of duplicating the translation hack. https://bugzilla.gnome.org/show_bug.cgi?id=720200
Works for me, thanks!