[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/advanced-dialog.c |    2 +-
 properties/nm-pptp.c         |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

 NOTE: This should also be applied to NetworkManager-pptp NM_0_8 branch.

diff --git a/properties/advanced-dialog.c b/properties/advanced-dialog.c
index 3c5b23b..a71e356 100644
--- a/properties/advanced-dialog.c
+++ b/properties/advanced-dialog.c
@@ -414,6 +414,7 @@ advanced_dialog_new (GHashTable *hash)
 	ui_file = g_strdup_printf ("%s/%s", UIDIR, "nm-pptp-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 ? error->message : "(unknown)");
@@ -421,7 +422,6 @@ advanced_dialog_new (GHashTable *hash)
 		g_object_unref (G_OBJECT (builder));
 		goto out;
 	}
-	gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
 
 	dialog = GTK_WIDGET (gtk_builder_get_object (builder, "pptp-advanced-dialog"));
 	if (!dialog) {
diff --git a/properties/nm-pptp.c b/properties/nm-pptp.c
index b24461a..d2303ce 100644
--- a/properties/nm-pptp.c
+++ b/properties/nm-pptp.c
@@ -404,6 +404,8 @@ nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
 	ui_file = g_strdup_printf ("%s/%s", UIDIR, "nm-pptp-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)");
@@ -416,8 +418,6 @@ nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
 	}
 	g_free (ui_file);
 
-	gtk_builder_set_translation_domain (priv->builder, GETTEXT_PACKAGE);
-
 	priv->widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "pptp-vbox"));
 	if (!priv->widget) {
 		g_set_error (error, PPTP_PLUGIN_UI_ERROR, 0, "could not load UI widget");
-- 
1.7.6



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