[glib] gstrfuncs: Fix translation issues



commit e8222c334318a2fce87a32bcd321580623eb00be
Author: Krzesimir Nowak <krzesimir kinvolk io>
Date:   Wed May 10 16:03:20 2017 +0200

    gstrfuncs: Fix translation issues
    
    The tool that extracts the translatable strings to .po files does not
    cope with the G_GUINTX_FORMAT macros, so we preformat the numbers to
    strings and use the strings in the translatable error messages.

 glib/gstrfuncs.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
index 8a52bd5..a9f5754 100644
--- a/glib/gstrfuncs.c
+++ b/glib/gstrfuncs.c
@@ -3263,11 +3263,15 @@ g_ascii_string_to_signed (const gchar  *str,
     }
   if (saved_errno == ERANGE || number < min || number > max)
     {
+      gchar *min_str = g_strdup_printf ("%" G_GINT64_FORMAT, min);
+      gchar *max_str = g_strdup_printf ("%" G_GINT64_FORMAT, max);
+
       g_set_error (error,
                    G_NUMBER_PARSER_ERROR, G_NUMBER_PARSER_ERROR_OUT_OF_BOUNDS,
-                   _("Number “%" G_GINT64_FORMAT "” is out of bounds"
-                   " [%" G_GINT64_FORMAT ", %" G_GINT64_FORMAT "]"),
-                   number, min, max);
+                   _("Number “%s” is out of bounds [%s, %s]"),
+                   str, min_str, max_str);
+      g_free (min_str);
+      g_free (max_str);
       return FALSE;
     }
   if (out_num != NULL)
@@ -3362,11 +3366,15 @@ g_ascii_string_to_unsigned (const gchar  *str,
     }
   if (saved_errno == ERANGE || number < min || number > max)
     {
+      gchar *min_str = g_strdup_printf ("%" G_GUINT64_FORMAT, min);
+      gchar *max_str = g_strdup_printf ("%" G_GUINT64_FORMAT, max);
+
       g_set_error (error,
                    G_NUMBER_PARSER_ERROR, G_NUMBER_PARSER_ERROR_OUT_OF_BOUNDS,
-                   _("Number “%" G_GUINT64_FORMAT "” is out of bounds"
-                     " [%" G_GUINT64_FORMAT ", %" G_GUINT64_FORMAT "]"),
-                   number, min, max);
+                   _("Number “%s” is out of bounds [%s, %s]"),
+                   str, min_str, max_str);
+      g_free (min_str);
+      g_free (max_str);
       return FALSE;
     }
   if (out_num != NULL)


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