[nautilus/wip/oholy/gettext-fix] file: Drop string concatenation to make gettext work properly




commit 3ac92ca51acc3c1446258249f830b83aff994499
Author: Ondrej Holy <oholy redhat com>
Date:   Fri Aug 12 09:34:56 2022 +0200

    file: Drop string concatenation to make gettext work properly
    
    The commit 35647f2 fixed build on 32-bit architectures using the relevant
    format string, but gettext isn't able to extract the text now due to string
    concatenation. Let's use the format string outside of the `ngettext` function
    to fix the issue.
    
    Related: https://gitlab.gnome.org/GNOME/nautilus/-/merge_requests/940

 src/nautilus-file.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 2d6f58857..2807c85d9 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -6924,6 +6924,7 @@ nautilus_file_get_size_as_string_with_real_size (NautilusFile *file)
 {
     guint item_count;
     gboolean count_unreadable;
+    g_autofree char *size_str = NULL;
 
     if (file == NULL)
     {
@@ -6946,10 +6947,11 @@ nautilus_file_get_size_as_string_with_real_size (NautilusFile *file)
         return NULL;
     }
 
-    return g_strdup_printf (ngettext ("%" G_GOFFSET_FORMAT " byte",
-                                      "%" G_GOFFSET_FORMAT " bytes",
+    size_str = g_strdup_printf ("%" G_GOFFSET_FORMAT, file->details->size);
+    return g_strdup_printf (ngettext ("%s byte",
+                                      "%s bytes",
                                       file->details->size),
-                            file->details->size);
+                            size_str);
 }
 
 


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