mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-14 08:16:24 +01:00
gregex: use %s format specifier for localized error message
This commit is contained in:
parent
0be4611726
commit
5cd94a0982
@ -1661,6 +1661,7 @@ regex_compile (const gchar *pattern,
|
|||||||
if (re == NULL)
|
if (re == NULL)
|
||||||
{
|
{
|
||||||
GError *tmp_error;
|
GError *tmp_error;
|
||||||
|
gchar *offset_str;
|
||||||
|
|
||||||
/* Translate the PCRE error code to GRegexError and use a translated
|
/* Translate the PCRE error code to GRegexError and use a translated
|
||||||
* error message if possible */
|
* error message if possible */
|
||||||
@ -1669,11 +1670,13 @@ regex_compile (const gchar *pattern,
|
|||||||
/* PCRE uses byte offsets but we want to show character offsets */
|
/* PCRE uses byte offsets but we want to show character offsets */
|
||||||
erroffset = g_utf8_pointer_to_offset (pattern, &pattern[erroffset]);
|
erroffset = g_utf8_pointer_to_offset (pattern, &pattern[erroffset]);
|
||||||
|
|
||||||
|
offset_str = g_strdup_printf ("%" G_GSIZE_FORMAT, erroffset);
|
||||||
tmp_error = g_error_new (G_REGEX_ERROR, errcode,
|
tmp_error = g_error_new (G_REGEX_ERROR, errcode,
|
||||||
_("Error while compiling regular "
|
_("Error while compiling regular expression ‘%s’ "
|
||||||
"expression %s at char %" G_GSIZE_FORMAT ": %s"),
|
"at char %s: %s"),
|
||||||
pattern, erroffset, errmsg);
|
pattern, offset_str, errmsg);
|
||||||
g_propagate_error (error, tmp_error);
|
g_propagate_error (error, tmp_error);
|
||||||
|
g_free (offset_str);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user