GNOME Bugzilla – Bug 763056
The whole application translated to Hebrew but appear in English
Last modified: 2016-03-04 00:07:33 UTC
The whole application are translated to Hebrew[1] but still appear in English (but the interface is from right to left as it should be in Hebrew). [1] https://git.gnome.org/browse/hitori/tree/po/he.po
Didn't this work in the past?
The problem is that you use gettext from constructed without explicitly calling setlocale. GtkApplication _will_ call gtk_init (and thus setlocale) for you, but only from startup(), which is much later than constructed. This causes glib to determine and remember that it should not translate anything because some translations are missing. Putting a setlocale call early in constructed should fix it
(In reply to Matthias Clasen from comment #2) > The problem is that you use gettext from constructed without explicitly > calling setlocale. GtkApplication _will_ call gtk_init (and thus setlocale) > for you, but only from startup(), which is much later than constructed. > > This causes glib to determine and remember that it should not translate > anything because some translations are missing. > > Putting a setlocale call early in constructed should fix it Nope, the path being passed to bindtextdomain() was wrong, so gettext was looking for translations in the wrong place. Fixed. commit b91ab2d3aed8429774439edc92b3ce90cddf60ec Author: Philip Withnall <philip.withnall@collabora.co.uk> Date: Thu Mar 3 20:39:21 2016 +0000 build: Fix definition of PACKAGE_LOCALE_DIR This is passed to bindtextdomain() to allow it to find translations, so needs to be correct for translations to work. https://bugzilla.gnome.org/show_bug.cgi?id=763056 Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
I think startup is too late to initialize translations, because then the help for the command line options doesn't get translated. We normally do this in main, before creating the GtkApplication, but it's good to know constructed works too.