mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 18:52:09 +01:00
gfileutils: Use g_format_size() for a translatable string
Partially because the use of `G_GSIZE_MODIFIER` breaks translatable string extraction (issue #3271) and partially because `g_format_size()` produces more human-readable results anyway. Prior to commit cf5e371c67 the code was using `%lu`, so this is a fairly new issue. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Fixes: #3271
This commit is contained in:
parent
5b022f903c
commit
a3c2691c23
@ -709,14 +709,19 @@ get_contents_stdio (const gchar *filename,
|
|||||||
|
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
{
|
{
|
||||||
|
char *display_size = g_format_size_full (total_allocated, G_FORMAT_SIZE_LONG_FORMAT);
|
||||||
display_filename = g_filename_display_name (filename);
|
display_filename = g_filename_display_name (filename);
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_FILE_ERROR,
|
G_FILE_ERROR,
|
||||||
G_FILE_ERROR_NOMEM,
|
G_FILE_ERROR_NOMEM,
|
||||||
g_dngettext (GETTEXT_PACKAGE, "Could not allocate %" G_GSIZE_MODIFIER "u byte to read file “%s”", "Could not allocate %" G_GSIZE_MODIFIER "u bytes to read file “%s”", total_allocated),
|
/* Translators: the first %s contains the file size
|
||||||
total_allocated,
|
* (already formatted with units), and the second %s
|
||||||
|
* contains the file name */
|
||||||
|
_("Could not allocate %s to read file “%s”"),
|
||||||
|
display_size,
|
||||||
display_filename);
|
display_filename);
|
||||||
g_free (display_filename);
|
g_free (display_filename);
|
||||||
|
g_free (display_size);
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user