GUI translations fail when loaded from a custom directory (always in 3.22.28 since 3.14.x)
/!\ No change from 2015-08-23 15:25 UTC
Source: https://bugzilla.gnome.org/show_bug.cgi?id=753991
Please resolve this blocked bug! Thanks in advance.
Tobias Schönberg [reporter] 2015-08-23 15:25:03 UTC
When trying to load the GUI translations in Python under Windows:
if sys.platform.startswith('win'):
if os.getenv('LANG') is None:
lang, enc = locale.getdefaultlocale()
os.environ['LANG'] = lang
import ctypes
LIB_INTL = abspath(join(WHERE_AM_I, "../gnome/libintl-8.dll"))
libintl = ctypes.cdll.LoadLibrary(LIB_INTL)
lc = locale.setlocale(locale.LC_ALL, "")
btd = libintl.bindtextdomain(APP, LOCALE_DIR)
libintl.bind_textdomain_codeset(APP, "UTF-8")
a subsequent call to translate the GUI will fail (silently!):
builder = Gtk.Builder()
builder.set_translation_domain(APP)
This is probably a bug in g_dgettext, and Glib.dgettext(APP, "") should have a return value.
A workaround for this bug is to place the mo-files into (for German for example): /gnome/share/locale/de/LC_MESSAGES/myapp.mo
I have an example program here where I will inform about the bug and the workaround: https://github.com/tobias47n9e/pygobject-locale
Comment 1 Tobias Schönberg [reporter] 2015-08-26 10:54:17 UTC
There is a related discussion here: https://sourceforge.net/p/pygobjectwin32/tickets/22/
Comment 2 Tobias Schönberg [reporter] 2015-10-24 13:30:53 UTC
Bajusz Tamás found a workaround for the bug:
I uploaded the working example packaged with pynsist here:
One can change between English and German locale and the GUI gets translated correctly.
All non-ASCII characters are shown. Commenting out the line self.translate_gui() makes the translation fail again.
My conclusion is that there is something going wrong with the translation of the GUI if only set_translation_domain() is used.
Comment 3 Matthias Clasen [gtk+ developer] 2018-02-10 05:20:43 UTC
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
Comment 4 lovetox 2018-03-10 22:31:37 UTC
Created attachment 369543 [details]
minimal example
Yes this is still a issue
Please tell us how to get translation on Windows working
Glade files are just not translated