From 52e09cf5265b6fd1bfeaeda8a8e7b4db26b91998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sat, 8 Sep 2018 08:40:42 +0200 Subject: [PATCH] Windows: Fix translation Fixes #9324 --- gajim/application.py | 4 ++-- gajim/gtk/util.py | 5 ++++- gajim/gtkgui_helpers.py | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gajim/application.py b/gajim/application.py index 22d4a5aae..c46a39c05 100644 --- a/gajim/application.py +++ b/gajim/application.py @@ -182,8 +182,8 @@ class GajimApplication(Gtk.Application): # Set Application Menu app.app = self - from gajim import gtkgui_helpers - builder = gtkgui_helpers.get_gtk_builder('application_menu.ui') + from gajim.gtk.util import get_builder + builder = get_builder('application_menu.ui') menubar = builder.get_object("menubar") appmenu = builder.get_object("appmenu") if app.prefers_app_menu(): diff --git a/gajim/gtk/util.py b/gajim/gtk/util.py index 4c918f6b4..eafc626ce 100644 --- a/gajim/gtk/util.py +++ b/gajim/gtk/util.py @@ -68,7 +68,10 @@ def get_builder(file_name, widget=None): if widget is not None: builder.add_objects_from_string(xml_text, [widget]) else: - builder.add_from_string(xml_text) + # Workaround + # https://gitlab.gnome.org/GNOME/pygobject/issues/255 + Gtk.Builder.__mro__[1].add_from_string( + builder, xml_text, len(xml_text.encode("utf-8"))) else: if widget is not None: builder.add_objects_from_file(file_path, [widget]) diff --git a/gajim/gtkgui_helpers.py b/gajim/gtkgui_helpers.py index 8afeaf27a..c9d36d82d 100644 --- a/gajim/gtkgui_helpers.py +++ b/gajim/gtkgui_helpers.py @@ -140,7 +140,10 @@ def get_gtk_builder(file_name, widget=None): if widget is not None: builder.add_objects_from_string(xml_text, [widget]) else: - builder.add_from_string(xml_text) + # Workaround + # https://gitlab.gnome.org/GNOME/pygobject/issues/255 + Gtk.Builder.__mro__[1].add_from_string( + builder, xml_text, len(xml_text.encode("utf-8"))) else: if widget is not None: builder.add_objects_from_file(file_path, [widget])