[gnome-software] sources dialog: Improved way to break up a sentence for translation



commit f4a0371c0c8c6b668fd595bcf4244eeb9e73d565
Author: Rafal Luzynski <digitalfreak lingonborough com>
Date:   Wed Feb 18 23:59:26 2015 +0100

    sources dialog: Improved way to break up a sentence for translation
    
    This is the second attempt to handle the translation of the sentence
    '%i applications and %i add-ons installed' correctly. This patch
    explicitly splits it into 3 simple cases: no software installed,
    only applications installed, and only add-ons installed, and the
    4th complex case where some applications and some add-ons are
    installed. In this last case the words 'and' and 'installed'
    may depend on the number of apps, add-ons, or total.
    
    This patch reverts some changes from the previous commit.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726990

 src/gs-sources-dialog.c |   40 +++++++++++++++++++++-------------------
 1 files changed, 21 insertions(+), 19 deletions(-)
---
diff --git a/src/gs-sources-dialog.c b/src/gs-sources-dialog.c
index e753136..fd8f0b2 100644
--- a/src/gs-sources-dialog.c
+++ b/src/gs-sources-dialog.c
@@ -90,16 +90,6 @@ add_source (GtkListBox *listbox, GsApp *app)
                }
        }
 
-       /* TRANSLATORS: This string is used to construct the 'X applications
-          and y add-ons installed' sentence, describing a software source. */
-       apps_text = g_strdup_printf (ngettext ("%i application",
-                                              "%i applications",
-                                              cnt_apps), cnt_apps);
-       /* TRANSLATORS: This string is used to construct the 'X applications
-          and y add-ons installed' sentence, describing a software source. */
-       addons_text = g_strdup_printf (ngettext ("%i add-on",
-                                                "%i add-ons",
-                                                cnt_addon), cnt_addon);
        if (cnt_apps == 0 && cnt_addon == 0) {
                /* TRANSLATORS: This string describes a software source that
                   has no software installed from it. */
@@ -107,20 +97,32 @@ add_source (GtkListBox *listbox, GsApp *app)
        } else if (cnt_addon == 0) {
                /* TRANSLATORS: This string is used to construct the 'X applications
                   installed' sentence, describing a software source. */
-               text = g_strdup_printf (ngettext ("%s installed",
-                                                 "%s installed",
-                                                 cnt_apps),
-                                                 apps_text);
+               text = g_strdup_printf (ngettext ("%i application installed",
+                                                 "%i applications installed",
+                                                 cnt_apps), cnt_apps);
        } else if (cnt_apps == 0) {
                /* TRANSLATORS: This string is used to construct the 'X add-ons
                   installed' sentence, describing a software source. */
-               text = g_strdup_printf (ngettext ("%s installed",
-                                                 "%s installed",
-                                                 cnt_addon),
-                                                 addons_text);
+               text = g_strdup_printf (ngettext ("%i add-on installed",
+                                                 "%i add-ons installed",
+                                                 cnt_addon), cnt_addon);
        } else {
                /* TRANSLATORS: This string is used to construct the 'X applications
-                  and y add-ons installed' sentence, describing a software source. */
+                  and y add-ons installed' sentence, describing a software source.
+                  The correct form here depends on the number of applications. */
+               apps_text = g_strdup_printf (ngettext ("%i application",
+                                                      "%i applications",
+                                                      cnt_apps), cnt_apps);
+               /* TRANSLATORS: This string is used to construct the 'X applications
+                  and y add-ons installed' sentence, describing a software source.
+                  The correct form here depends on the number of add-ons. */
+               addons_text = g_strdup_printf (ngettext ("%i add-on",
+                                                        "%i add-ons",
+                                                        cnt_addon), cnt_addon);
+               /* TRANSLATORS: This string is used to construct the 'X applications
+                  and y add-ons installed' sentence, describing a software source.
+                  The correct form here depends on the total number of
+                  applications and add-ons. */
                text = g_strdup_printf (ngettext ("%s and %s installed",
                                                  "%s and %s installed",
                                                  cnt_apps + cnt_addon),


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