commit cf3d45b8e4c1981bd3dd1bbae0b550e88bd63dc9
Author: federico <federico@8b9f5b79-e825-0410-8eac-f7d894c94d18>
Date:   Wed Sep 19 20:23:58 2007 +0000

    Make ngettext work
    
    
    git-svn-id: svn+ssh://svn.gnome.org/svn/sabayon/trunk@870 8b9f5b79-e825-0410-8eac-f7d894c94d18

diff --git a/ChangeLog b/ChangeLog
index c8ad8a9..9546266 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2007-09-19  Federico Mena Quintero  <federico@novell.com>
 
+	Fix http://bugzilla.gnome.org/show_bug.cgi?id=475434 - Plurals
+	were not getting translated as gettext.ngettext() assumes
+	textdomain() / bindtextdomain() have been called, but we use
+	gettext.install() instead.
+
+	* lib/util.py (init_gettext): Add ngettext as part of the "names"
+	argument to gettext.install, so that ngettext() will get bound as a
+	built-in.
+
+	* admin-tool/saveconfirm.py (SaveConfirmationAlert.__init__): Call
+	ngettext(), not gettext.ngettext(); the former is now bound as a
+	built-in.
+
+2007-09-19  Federico Mena Quintero  <federico@novell.com>
+
 	Fix http://bugzilla.gnome.org/show_bug.cgi?id=450085 - Strings
 	coming from sabayon.glade do not appear translated.
 
diff --git a/admin-tool/saveconfirm.py b/admin-tool/saveconfirm.py
index 156137d..b53b98d 100755
--- a/admin-tool/saveconfirm.py
+++ b/admin-tool/saveconfirm.py
@@ -42,28 +42,28 @@ class SaveConfirmationAlert (gtk.MessageDialog):
                          + "</b>")
 
         if seconds < 55:
-            secondary_msg = gettext.ngettext ("If you don't save, changes from the last %ld second "
-                                              "will be permanently lost.",
-                                              "If you don't save, changes from the last %ld seconds "
-                                              "will be permanently lost.",
-                                              seconds) % seconds
+            secondary_msg = ngettext ("If you don't save, changes from the last %ld second "
+                                      "will be permanently lost.",
+                                      "If you don't save, changes from the last %ld seconds "
+                                      "will be permanently lost.",
+                                      seconds) % seconds
         elif seconds < 75:
             secondary_msg = _("If you don't save, changes from the last minute will be permanently lost.")
             
         elif seconds < 110:
             seconds -= 60
-            secondary_msg = gettext.ngettext ("If you don't save, changes from the last minute and %ld "
-                                              "second will be permanently lost.",
-                                              "If you don't save, changes from the last minute and %ld "
-                                              "seconds will be permanently lost.",
-                                              seconds) % seconds
+            secondary_msg = ngettext ("If you don't save, changes from the last minute and %ld "
+                                      "second will be permanently lost.",
+                                      "If you don't save, changes from the last minute and %ld "
+                                      "seconds will be permanently lost.",
+                                      seconds) % seconds
         elif seconds < 3600:
             minutes = seconds / 60
-            secondary_msg = gettext.ngettext ("If you don't save, changes from the last %ld minute "
-                                              "will be permanently lost.",
-                                              "If you don't save, changes from the last %ld minutes "
-                                              "will be permanently lost.",
-                                              minutes) % minutes
+            secondary_msg = ngettext ("If you don't save, changes from the last %ld minute "
+                                      "will be permanently lost.",
+                                      "If you don't save, changes from the last %ld minutes "
+                                      "will be permanently lost.",
+                                      minutes) % minutes
         elif seconds < 7200:
             seconds -= 3600;
             minutes = seconds / 60;
@@ -71,17 +71,17 @@ class SaveConfirmationAlert (gtk.MessageDialog):
                 secondary_msg = _("If you don't save, changes from the last hour "
                                   "will be permanently lost.")
             else:
-                secondary_msg = gettext.ngettext ("If you don't save, changes from the last hour and %d "
-                                                  "minute will be permanently lost.",
-                                                  "If you don't save, changes from the last hour and %d "
-                                                  "minutes will be permanently lost.",
-                                                  minutes) % minutes
+                secondary_msg = ngettext ("If you don't save, changes from the last hour and %d "
+                                          "minute will be permanently lost.",
+                                          "If you don't save, changes from the last hour and %d "
+                                          "minutes will be permanently lost.",
+                                          minutes) % minutes
         else:
             hours = seconds / 3600;
-            secondary_msg = gettext.ngettext ("If you don't save, changes from the last %d hour "
-                                              "will be permanently lost.",
-                                              "If you don't save, changes from the last %d hours "
-                                              "will be permanently lost.",
-                                              hours) % hours
+            secondary_msg = ngettext ("If you don't save, changes from the last %d hour "
+                                      "will be permanently lost.",
+                                      "If you don't save, changes from the last %d hours "
+                                      "will be permanently lost.",
+                                      hours) % hours
                                                             
         self.format_secondary_text (secondary_msg)
diff --git a/lib/util.py b/lib/util.py
index e0e0312..0582664 100755
--- a/lib/util.py
+++ b/lib/util.py
@@ -110,11 +110,11 @@ def print_exception ():
 
 def init_gettext ():
     """Binds _() to gettext.gettext() in the global namespace. Run
-    util.init_gettext() at the entry point to any script and you'll
-    be able to use _() to mark strings for translation.
-    """
+    util.init_gettext() at the entry point to any script and you'll be
+    able to use _(), gettext(), and ngettext() to mark strings for
+    translation."""
     locale.setlocale (locale.LC_ALL, "")
-    gettext.install (PACKAGE, LOCALEDIR)
+    gettext.install (PACKAGE, LOCALEDIR, names=("gettext", "ngettext"))
 
 def random_string (len):
     """Returns a string with random binary data of the specified length"""
