[pybliographer/wip/gtk3] l10n: Add missing plural handling



commit c01060d350db5242adfb3b1e03765d6af755b29e
Author: Marek Černocký <marek manet cz>
Date:   Sun May 18 09:00:00 2014 -0700

    l10n: Add missing plural handling
    
    https://wiki.gnome.org/TranslationProject/DevGuidelines/Plurals
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705246

 Pyblio/GnomeUI/Document.py |   13 +++++++------
 scripts/pybliocheck.py     |    7 ++++++-
 2 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/Pyblio/GnomeUI/Document.py b/Pyblio/GnomeUI/Document.py
index 3b7d2c6..0ba6729 100644
--- a/Pyblio/GnomeUI/Document.py
+++ b/Pyblio/GnomeUI/Document.py
@@ -26,6 +26,7 @@
 from gi.repository import GObject
 
 from gettext import gettext as _
+from gettext import ngettext as _n 
 from gi.repository import Gtk, Gdk, GdkPixbuf
 
 from Pyblio.GnomeUI import Editor, Entry, FileSelector, Format
@@ -441,12 +442,10 @@ class Document (Connector.Publisher):
         
         if li == ld:
             if   ld == 0: num = _("[no entry]")
-            elif ld == 1: num = _("[1 entry]")
-            else:         num = _("[%d entries]")    %  ld
+            else:         num = _n("[%d entry]", "[%d entries]", ld) % ld
         else:
             if   ld == 0: num = _("[no entry]")
-            elif ld == 1: num = _("[%d/1 entry]")    % li
-            else:         num = _("[%d/%d entries]") % (li, ld)
+            else:         num = _n("[%d/%d entry]", "[%d/%d entries]", ld) % (li, ld)
 
         text = text + ' ' + num
         
@@ -954,7 +953,9 @@ class Document (Connector.Publisher):
         if l == 0: return
 
         if l > 5:
-            if not Utils.Callback (_("Really edit %d entries?")
+            if not Utils.Callback (_n("Really edit %d entry?", 
+                                      "Really edit %d entries?",
+                                      l)
                                    % l, parent = self.w).answer ():
                 return
 
@@ -1001,7 +1002,7 @@ class Document (Connector.Publisher):
         offset = self.index.get_item_position (entries [-1])
 
         if l > 1:
-            question = _("Remove all the %d entries?") % len (entries)
+            question = _n("Remove %d entry?", "Remove all %d entries?", l) % l
         else:
             question = _("Remove entry `%s'?") % entries [0].key.key
             
diff --git a/scripts/pybliocheck.py b/scripts/pybliocheck.py
index 06e889b..15977bc 100644
--- a/scripts/pybliocheck.py
+++ b/scripts/pybliocheck.py
@@ -22,6 +22,8 @@
 
 import os, sys, string
 from Pyblio import Config, Exceptions
+from gettext import gettext as _
+from gettext import ngettext as _n
 
 import locale
 charset = locale.getlocale () [1] or 'ascii'
@@ -57,7 +59,10 @@ for dir in sys.argv [2:]:
         # try to open the database
         try:
             b = bibopen (f)
-            print (_("file `%s' is ok [%d entries]") % (f, len (b))).encode (charset)
+            print (_n("file “%s” is ok [%d entry]", 
+                      "file “%s” is ok [%d entries]", 
+                      len(b)) 
+                   % (f, len (b))).encode (charset)
         except (Exceptions.ParserError, KeyError), err:
             broken.append (str (err))
 


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