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.
This commit is contained in:
Krzesimir Nowak 2017-05-10 16:03:20 +02:00
parent 6b19907a4f
commit e8222c3343

View File

@ -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)