diff options
author | Carlos Soriano <csoriano@gnome.org> | 2015-12-15 15:56:46 +0100 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-12-15 14:59:13 -0500 |
commit | 8858c3aaa0f1df899b533c61459f4f37e8928442 (patch) | |
tree | 13e9ace690ebb02153fae5ecbab4c91e3142d38e /gtk/gtkplacesviewrow.c | |
parent | 4eeeb5811d0b026bd55260666f5fc3236ad00479 (diff) | |
download | gtk+-8858c3aaa0f1df899b533c61459f4f37e8928442.tar.gz |
gtkplacesviewrow: plural form for available space
We were not supporting plural form of the available space, which
is a problem in some languages.
However in this case is kind of a difficult matter, since we use a
formatted string from glib with g_format_size.
To fix it, use the same behavior as g_format_size to decide when
it should be used a plural form or not.
https://bugzilla.gnome.org/show_bug.cgi?id=759491
Diffstat (limited to 'gtk/gtkplacesviewrow.c')
-rw-r--r-- | gtk/gtkplacesviewrow.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gtk/gtkplacesviewrow.c b/gtk/gtkplacesviewrow.c index d797c18e8a..a742ff902d 100644 --- a/gtk/gtkplacesviewrow.c +++ b/gtk/gtkplacesviewrow.c @@ -89,6 +89,7 @@ measure_available_space_finished (GObject *object, gchar *formatted_free_size; gchar *formatted_total_size; gchar *label; + guint plural_form; error = NULL; @@ -120,8 +121,16 @@ measure_available_space_finished (GObject *object, formatted_free_size = g_format_size (free_space); formatted_total_size = g_format_size (total_space); - /* Translators: respectively, free and total space of the drive */ - label = g_strdup_printf (_("%s / %s available"), formatted_free_size, formatted_total_size); + + /* read g_format_size code in glib for further understanding */ + plural_form = free_space < 1000 ? free_space : free_space % 1000 + 1000; + + /* Translators: respectively, free and total space of the drive. The plural form + * should be based on the free space available. + * i.e. 1 GB / 24 GB available. + */ + label = g_strdup_printf (ngettext ("%s / %s available", "%s / %s available", plural_form), + formatted_free_size, formatted_total_size); gtk_label_set_label (row->available_space_label, label); |