[gtk+/wip/matthiasc/builder-tool: 3/4] Translate error messages



commit c45502ab3b5f1d766447c7d55b1e97d5e6aac092
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Apr 27 18:39:22 2015 -0400

    Translate error messages

 gtk/gtk-builder-tool.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtk-builder-tool.c b/gtk/gtk-builder-tool.c
index 45c4daa..887df74 100644
--- a/gtk/gtk-builder-tool.c
+++ b/gtk/gtk-builder-tool.c
@@ -19,6 +19,8 @@
 
 #include <stdlib.h>
 #include <string.h>
+
+#include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
 
@@ -69,19 +71,18 @@ value_is_default (ParserData *data,
 
   if (pspec == NULL)
     {
-      g_printerr ("P%sroperty %s::%s not found\n", data->packing ? "acking p" : "", class_name, 
property_name);
+      if (data->packing)
+        g_printerr (_("Packing property %s::%s not found\n"), class_name, property_name);
+      else
+        g_printerr (_("Property %s::%s not found\n"), class_name, property_name);
       return FALSE;
     }
   else if (g_type_is_a (G_PARAM_SPEC_VALUE_TYPE (pspec), G_TYPE_OBJECT))
     return FALSE;
 
-  if (!gtk_builder_value_from_string (data->builder,
-                                      pspec,
-                                      value_string,
-                                      &value,
-                                      &error))
+  if (!gtk_builder_value_from_string (data->builder, pspec, value_string, &value, &error))
     {
-      g_printerr ("Error parsing value: %s\n", error->message);
+      g_printerr (_("Couldn't parse value: %s\n"), error->message);
       g_error_free (error);
       ret = FALSE;
     }
@@ -371,7 +372,7 @@ do_simplify (const gchar *filename)
 
   if (!g_file_get_contents (filename, &buffer, NULL, &error))
     {
-      g_printerr ("Failed to read file: %s\n", error->message);
+      g_printerr (_("Can't load file: %s\n"), error->message);
       return FALSE;
     }
 
@@ -388,7 +389,7 @@ do_simplify (const gchar *filename)
   context = g_markup_parse_context_new (&parser, G_MARKUP_TREAT_CDATA_AS_TEXT, &data, NULL);
   if (!g_markup_parse_context_parse (context, buffer, -1, &error))
     {
-      g_printerr ("Failed to parse file: %s\n", error->message);
+      g_printerr (_("Can't parse file: %s\n"), error->message);
       return FALSE;
     }
 
@@ -418,14 +419,16 @@ do_validate (const gchar *filename)
 static void
 usage (void)
 {
-  g_print ("Usage: gtk-builder-tool FILE\n"
-           "Validate and simplify GtkBuilder .ui files.\n");
+  g_print (_("Usage: gtk-builder-tool FILE\n"
+             "Validate and simplify GtkBuilder .ui files.\n"));
   exit (1);
 }
 
 int
 main (int argc, char *argv[])
 {
+  g_set_prgname ("gtk-builder-tool");
+
   gtk_init (NULL, NULL);
 
   gtk_test_register_all_types ();


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