[PATCH] Fix gtk_builder_set_translation_domain() calling



gtk_builder_set_translation_domain() should be called before
gtk_builder_add_from_file(). This fixes UI messages always in English
problem.
---
 properties/auth-helpers.c |    4 ++--
 properties/nm-openvpn.c   |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

NOTE: This should also be applied to NM_0_8 branch.

diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index 9112e34..8d4764e 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -1308,6 +1308,8 @@ advanced_dialog_new (GHashTable *hash, const char *contype)
 	ui_file = g_strdup_printf ("%s/%s", UIDIR, "nm-openvpn-dialog.ui");
 	builder = gtk_builder_new ();
 
+	gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
+
 	if (!gtk_builder_add_from_file (builder, ui_file, &error)) {
 		g_warning ("Couldn't load builder file: %s", error->message);
 		g_error_free (error);
@@ -1315,8 +1317,6 @@ advanced_dialog_new (GHashTable *hash, const char *contype)
 		goto out;
 	}
 
-	gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
-
 	dialog = GTK_WIDGET (gtk_builder_get_object (builder, "openvpn-advanced-dialog"));
 	if (!dialog) {
 		g_object_unref (G_OBJECT (builder));
diff --git a/properties/nm-openvpn.c b/properties/nm-openvpn.c
index 13f0431..3e09869 100644
--- a/properties/nm-openvpn.c
+++ b/properties/nm-openvpn.c
@@ -507,6 +507,8 @@ nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
 	ui_file = g_strdup_printf ("%s/%s", UIDIR, "nm-openvpn-dialog.ui");
 	priv->builder = gtk_builder_new ();
 
+	gtk_builder_set_translation_domain (priv->builder, GETTEXT_PACKAGE);
+
 	if (!gtk_builder_add_from_file (priv->builder, ui_file, error)) {
 		g_warning ("Couldn't load builder file: %s",
 		           error && *error ? (*error)->message : "(unknown)");
@@ -518,8 +520,6 @@ nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
 		return NULL;
 	}
 
-	gtk_builder_set_translation_domain (priv->builder, GETTEXT_PACKAGE);
-
 	g_free (ui_file);
 
 	priv->widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "openvpn-vbox"));
-- 
1.7.6



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]