[gnome-documents] view: use ngettext() for date string plural forms



commit db7c51610bac2c9489ae0841b4ac502421a03909
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Mar 5 12:59:31 2012 -0500

    view: use ngettext() for date string plural forms
    
    Pointed out by Andre Klapper.

 src/view.js |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/view.js b/src/view.js
index 3ac5cc4..7d35d3a 100644
--- a/src/view.js
+++ b/src/view.js
@@ -21,6 +21,7 @@
 
 const Gd = imports.gi.Gd;
 const Gdk = imports.gi.Gdk;
+const Gettext = imports.gettext;
 const GLib = imports.gi.GLib;
 const Gtk = imports.gi.Gtk;
 const _ = imports.gettext.gettext;
@@ -194,19 +195,27 @@ View.prototype = {
                 } else if (difference < 2 * DAY) {
                     dateRenderer.text = _("Yesterday");
                 } else if (difference < 7 * DAY) {
-                    dateRenderer.text = _("%d days ago").format(days);
+                    dateRenderer.text = Gettext.ngettext("%d day ago",
+                                                         "%d days ago",
+                                                         days).format(days);
                 } else if (difference < 14 * DAY) {
                     dateRenderer.text = _("Last week");
                 } else if (difference < 28 * DAY) {
-                    dateRenderer.text = _("%d weeks ago").format(weeks);
+                    dateRenderer.text = Gettext.ngettext("%d week ago",
+                                                         "%d weeks ago",
+                                                         weeks).format(weeks);
                 } else if (difference < 60 * DAY) {
                     dateRenderer.text = _("Last month");
                 } else if (difference < 360 * DAY) {
-                    dateRenderer.text = _("%d months ago").format(months);
+                    dateRenderer.text = Gettext.ngettext("%d month ago",
+                                                         "%d months ago",
+                                                         months).format(months);
                 } else if (difference < 730 * DAY) {
                     dateRenderer.text = _("Last year");
                 } else {
-                    dateRenderer.text = _("%d years ago").format(years);
+                    dateRenderer.text = Gettext.ngettext("%d year ago",
+                                                         "%d years ago",
+                                                         years).format(years);
                 }
             }));
     },



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