pluralize the message-texts for search-results screens.
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Tue, 29 Mar 2011 01:53:37 +0000 (01:53 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Tue, 29 Mar 2011 01:53:37 +0000 (01:53 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/branches/i18n@1292 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/locale/django.pot
conifer/locale/en_CA/LC_MESSAGES/django.po
conifer/locale/eo/LC_MESSAGES/django.po
conifer/locale/fr_CA/LC_MESSAGES/django.po
conifer/plumbing/genshi_support.py
conifer/syrup/views/genshi_namespace.py
conifer/templates/item/item_add_cat_search.xhtml
conifer/templates/item/item_metadata.xhtml
conifer/templates/search_results.xhtml

index 9d13367..c9df9c3 100644 (file)
@@ -6,7 +6,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Syrup Reserves 0.1\n"
 "Report-Msgid-Bugs-To: Graham Fawcett <graham.fawcett@gmail.com>\n"
-"POT-Creation-Date: 2011-03-28 20:26-0400\n"
+"POT-Creation-Date: 2011-03-28 21:49-0400\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -632,8 +632,8 @@ msgstr ""
 msgid "Term"
 msgstr ""
 
-#: templates/open_sites.xhtml:19 templates/search_results.xhtml:31
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/open_sites.xhtml:19 templates/search_results.xhtml:35
+#: templates/item/item_add_cat_search.xhtml:65
 #: templates/item/item_delete_confirm.xhtml:28
 #: templates/item/item_metadata.xhtml:46
 msgid "Title"
@@ -659,21 +659,28 @@ msgstr ""
 msgid "Search Results"
 msgstr ""
 
-#: templates/search_results.xhtml:26
+#: templates/search_results.xhtml:27
 #, python-format
-msgid "You searched for: [1:%(query)s.] Found %(num)s matches."
+msgid "You searched for: [1:%(query)s.]"
 msgstr ""
 
-#: templates/search_results.xhtml:31
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/search_results.xhtml:28
+#, python-format
+msgid "Found %(num)s match."
+msgid_plural "Found %(num)s matches."
+msgstr[0] ""
+msgstr[1] ""
+
+#: templates/search_results.xhtml:35
+#: templates/item/item_add_cat_search.xhtml:65
 msgid "Author"
 msgstr ""
 
-#: templates/search_results.xhtml:31
+#: templates/search_results.xhtml:35
 msgid "Site"
 msgstr ""
 
-#: templates/search_results.xhtml:54
+#: templates/search_results.xhtml:58
 msgid "Your searches may return more results if you [1:log in] before searching."
 msgstr ""
 
@@ -1032,7 +1039,7 @@ msgid "Author #%(num)s"
 msgstr ""
 
 #: templates/item/common_metadata.xhtml:21
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/item/item_add_cat_search.xhtml:65
 #: templates/item/item_metadata.xhtml:50
 msgid "Publisher"
 msgstr ""
@@ -1108,36 +1115,38 @@ msgstr ""
 
 #: templates/item/item_add_cat_search.xhtml:49
 #, python-format
-msgid "%(first)s–%(last)s of %(total)s results."
-msgstr ""
+msgid "%(first)s result."
+msgid_plural "%(first)s–%(last)s of %(total)s results."
+msgstr[0] ""
+msgstr[1] ""
 
-#: templates/item/item_add_cat_search.xhtml:51
+#: templates/item/item_add_cat_search.xhtml:54
 #, python-format
 msgid "Previous %(count)s"
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:55
+#: templates/item/item_add_cat_search.xhtml:58
 #, python-format
 msgid "Next %(count)s"
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/item/item_add_cat_search.xhtml:65
 msgid "PubDate"
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:70
+#: templates/item/item_add_cat_search.xhtml:73
 msgid "details"
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:71
+#: templates/item/item_add_cat_search.xhtml:74
 msgid "Electronic resource."
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:72
+#: templates/item/item_add_cat_search.xhtml:75
 msgid "view"
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:82
+#: templates/item/item_add_cat_search.xhtml:85
 msgid "Pick this item"
 msgstr ""
 
@@ -1330,6 +1339,7 @@ msgstr ""
 msgid "Click here to download the document."
 msgstr ""
 
+#. Bytes will always be plural!
 #: templates/item/item_metadata.xhtml:113
 #, python-format
 msgid "Document type: %(type)s. Size: %(bytes)s bytes."
index bdcd961..3cb8668 100644 (file)
@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: Syrup Reserves 0.1\n"
 "Report-Msgid-Bugs-To: Graham Fawcett <graham.fawcett@gmail.com>\n"
 "POT-Creation-Date: 2011-03-28 20:22+0400\n"
-"PO-Revision-Date: 2011-03-28 20:26-0400\n"
+"PO-Revision-Date: 2011-03-28 21:49-0400\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: en_CA <LL@li.org>\n"
 "Plural-Forms: nplurals=2; plural=(n != 1)\n"
@@ -634,8 +634,8 @@ msgstr ""
 msgid "Term"
 msgstr ""
 
-#: templates/open_sites.xhtml:19 templates/search_results.xhtml:31
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/open_sites.xhtml:19 templates/search_results.xhtml:35
+#: templates/item/item_add_cat_search.xhtml:65
 #: templates/item/item_delete_confirm.xhtml:28
 #: templates/item/item_metadata.xhtml:46
 msgid "Title"
@@ -661,21 +661,28 @@ msgstr ""
 msgid "Search Results"
 msgstr ""
 
-#: templates/search_results.xhtml:26
+#: templates/search_results.xhtml:27
 #, python-format
-msgid "You searched for: [1:%(query)s.] Found %(num)s matches."
+msgid "You searched for: [1:%(query)s.]"
 msgstr ""
 
-#: templates/search_results.xhtml:31
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/search_results.xhtml:28
+#, fuzzy, python-format
+msgid "Found %(num)s match."
+msgid_plural "Found %(num)s matches."
+msgstr[0] ""
+msgstr[1] ""
+
+#: templates/search_results.xhtml:35
+#: templates/item/item_add_cat_search.xhtml:65
 msgid "Author"
 msgstr ""
 
-#: templates/search_results.xhtml:31
+#: templates/search_results.xhtml:35
 msgid "Site"
 msgstr ""
 
-#: templates/search_results.xhtml:54
+#: templates/search_results.xhtml:58
 msgid "Your searches may return more results if you [1:log in] before searching."
 msgstr ""
 
@@ -1034,7 +1041,7 @@ msgid "Author #%(num)s"
 msgstr ""
 
 #: templates/item/common_metadata.xhtml:21
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/item/item_add_cat_search.xhtml:65
 #: templates/item/item_metadata.xhtml:50
 msgid "Publisher"
 msgstr ""
@@ -1109,37 +1116,39 @@ msgid "Search"
 msgstr ""
 
 #: templates/item/item_add_cat_search.xhtml:49
-#, python-format
-msgid "%(first)s–%(last)s of %(total)s results."
-msgstr ""
+#, fuzzy, python-format
+msgid "%(first)s result."
+msgid_plural "%(first)s–%(last)s of %(total)s results."
+msgstr[0] ""
+msgstr[1] ""
 
-#: templates/item/item_add_cat_search.xhtml:51
+#: templates/item/item_add_cat_search.xhtml:54
 #, python-format
 msgid "Previous %(count)s"
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:55
+#: templates/item/item_add_cat_search.xhtml:58
 #, python-format
 msgid "Next %(count)s"
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/item/item_add_cat_search.xhtml:65
 msgid "PubDate"
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:70
+#: templates/item/item_add_cat_search.xhtml:73
 msgid "details"
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:71
+#: templates/item/item_add_cat_search.xhtml:74
 msgid "Electronic resource."
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:72
+#: templates/item/item_add_cat_search.xhtml:75
 msgid "view"
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:82
+#: templates/item/item_add_cat_search.xhtml:85
 msgid "Pick this item"
 msgstr ""
 
@@ -1332,6 +1341,7 @@ msgstr ""
 msgid "Click here to download the document."
 msgstr ""
 
+#. Bytes will always be plural!
 #: templates/item/item_metadata.xhtml:113
 #, python-format
 msgid "Document type: %(type)s. Size: %(bytes)s bytes."
index e95db39..214df61 100644 (file)
@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: Syrup Reserves 0.1\n"
 "Report-Msgid-Bugs-To: Graham Fawcett <graham.fawcett@gmail.com>\n"
 "POT-Creation-Date: 2011-03-28 20:22+0400\n"
-"PO-Revision-Date: 2011-03-28 20:26-0400\n"
+"PO-Revision-Date: 2011-03-28 21:49-0400\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: eo <LL@li.org>\n"
 "MIME-Version: 1.0\n"
@@ -648,8 +648,8 @@ msgstr "opEn SItEs"
 msgid "Term"
 msgstr "TErm"
 
-#: templates/open_sites.xhtml:19 templates/search_results.xhtml:31
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/open_sites.xhtml:19 templates/search_results.xhtml:35
+#: templates/item/item_add_cat_search.xhtml:65
 #: templates/item/item_delete_confirm.xhtml:28
 #: templates/item/item_metadata.xhtml:46
 msgid "Title"
@@ -675,21 +675,28 @@ msgstr "ChAngE"
 msgid "Search Results"
 msgstr "SEArch REsUlts"
 
-#: templates/search_results.xhtml:26
+#: templates/search_results.xhtml:27
 #, python-format
-msgid "You searched for: [1:%(query)s.] Found %(num)s matches."
-msgstr "YOU sEArchEd fOr: [1:%(query)s.] FOUnd %(num)s mAtchEs."
+msgid "You searched for: [1:%(query)s.]"
+msgstr "YOU sEArchEd fOr: [1:%(query)s.]"
 
-#: templates/search_results.xhtml:31
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/search_results.xhtml:28
+#, python-format
+msgid "Found %(num)s match."
+msgid_plural "Found %(num)s matches."
+msgstr[0] "FOUnd %(num)s mAtch."
+msgstr[1] "FOUnd %(num)s mAtchEs."
+
+#: templates/search_results.xhtml:35
+#: templates/item/item_add_cat_search.xhtml:65
 msgid "Author"
 msgstr "aUthOr"
 
-#: templates/search_results.xhtml:31
+#: templates/search_results.xhtml:35
 msgid "Site"
 msgstr "SItE"
 
-#: templates/search_results.xhtml:54
+#: templates/search_results.xhtml:58
 msgid ""
 "Your searches may return more results if you [1:log in] before searching."
 msgstr ""
@@ -1056,7 +1063,7 @@ msgid "Author #%(num)s"
 msgstr "aUthOr #%(num)s"
 
 #: templates/item/common_metadata.xhtml:21
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/item/item_add_cat_search.xhtml:65
 #: templates/item/item_metadata.xhtml:50
 msgid "Publisher"
 msgstr "PUblIshEr"
@@ -1132,36 +1139,38 @@ msgstr "SEArch"
 
 #: templates/item/item_add_cat_search.xhtml:49
 #, python-format
-msgid "%(first)s–%(last)s of %(total)s results."
-msgstr "%(first)s–%(last)s Of %(total)s rEsUlts."
+msgid "%(first)s result."
+msgid_plural "%(first)s–%(last)s of %(total)s results."
+msgstr[0] "%(first)s rEsUlt."
+msgstr[1] "%(first)s–%(last)s Of %(total)s rEsUlts."
 
-#: templates/item/item_add_cat_search.xhtml:51
+#: templates/item/item_add_cat_search.xhtml:54
 #, python-format
 msgid "Previous %(count)s"
 msgstr "PrEvIOUs %(count)s"
 
-#: templates/item/item_add_cat_search.xhtml:55
+#: templates/item/item_add_cat_search.xhtml:58
 #, python-format
 msgid "Next %(count)s"
 msgstr "NExt %(count)s"
 
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/item/item_add_cat_search.xhtml:65
 msgid "PubDate"
 msgstr "PUbDAtE"
 
-#: templates/item/item_add_cat_search.xhtml:70
+#: templates/item/item_add_cat_search.xhtml:73
 msgid "details"
 msgstr "dEtAIls"
 
-#: templates/item/item_add_cat_search.xhtml:71
+#: templates/item/item_add_cat_search.xhtml:74
 msgid "Electronic resource."
 msgstr "elEctrOnIc rEsOUrcE."
 
-#: templates/item/item_add_cat_search.xhtml:72
+#: templates/item/item_add_cat_search.xhtml:75
 msgid "view"
 msgstr "vIEw"
 
-#: templates/item/item_add_cat_search.xhtml:82
+#: templates/item/item_add_cat_search.xhtml:85
 msgid "Pick this item"
 msgstr "PIck thIs ItEm"
 
@@ -1363,6 +1372,7 @@ msgstr "REqUEst tO dOwnlOAd thIs dOcUmEnt"
 msgid "Click here to download the document."
 msgstr "ClIck hErE tO dOwnlOAd thE dOcUmEnt."
 
+#. Bytes will always be plural!
 #: templates/item/item_metadata.xhtml:113
 #, python-format
 msgid "Document type: %(type)s. Size: %(bytes)s bytes."
index 7f31b41..68e4347 100644 (file)
@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: Syrup Reserves 0.1\n"
 "Report-Msgid-Bugs-To: Graham Fawcett <graham.fawcett@gmail.com>\n"
 "POT-Creation-Date: 2011-03-28 20:22+0400\n"
-"PO-Revision-Date: 2011-03-28 20:26-0400\n"
+"PO-Revision-Date: 2011-03-28 21:49-0400\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: fr_CA <LL@li.org>\n"
 "Plural-Forms: nplurals=2; plural=(n > 1)\n"
@@ -634,8 +634,8 @@ msgstr ""
 msgid "Term"
 msgstr ""
 
-#: templates/open_sites.xhtml:19 templates/search_results.xhtml:31
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/open_sites.xhtml:19 templates/search_results.xhtml:35
+#: templates/item/item_add_cat_search.xhtml:65
 #: templates/item/item_delete_confirm.xhtml:28
 #: templates/item/item_metadata.xhtml:46
 msgid "Title"
@@ -661,21 +661,28 @@ msgstr ""
 msgid "Search Results"
 msgstr ""
 
-#: templates/search_results.xhtml:26
+#: templates/search_results.xhtml:27
 #, python-format
-msgid "You searched for: [1:%(query)s.] Found %(num)s matches."
+msgid "You searched for: [1:%(query)s.]"
 msgstr ""
 
-#: templates/search_results.xhtml:31
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/search_results.xhtml:28
+#, fuzzy, python-format
+msgid "Found %(num)s match."
+msgid_plural "Found %(num)s matches."
+msgstr[0] ""
+msgstr[1] ""
+
+#: templates/search_results.xhtml:35
+#: templates/item/item_add_cat_search.xhtml:65
 msgid "Author"
 msgstr ""
 
-#: templates/search_results.xhtml:31
+#: templates/search_results.xhtml:35
 msgid "Site"
 msgstr ""
 
-#: templates/search_results.xhtml:54
+#: templates/search_results.xhtml:58
 msgid "Your searches may return more results if you [1:log in] before searching."
 msgstr ""
 
@@ -1034,7 +1041,7 @@ msgid "Author #%(num)s"
 msgstr ""
 
 #: templates/item/common_metadata.xhtml:21
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/item/item_add_cat_search.xhtml:65
 #: templates/item/item_metadata.xhtml:50
 msgid "Publisher"
 msgstr ""
@@ -1109,37 +1116,39 @@ msgid "Search"
 msgstr ""
 
 #: templates/item/item_add_cat_search.xhtml:49
-#, python-format
-msgid "%(first)s–%(last)s of %(total)s results."
-msgstr ""
+#, fuzzy, python-format
+msgid "%(first)s result."
+msgid_plural "%(first)s–%(last)s of %(total)s results."
+msgstr[0] ""
+msgstr[1] ""
 
-#: templates/item/item_add_cat_search.xhtml:51
+#: templates/item/item_add_cat_search.xhtml:54
 #, python-format
 msgid "Previous %(count)s"
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:55
+#: templates/item/item_add_cat_search.xhtml:58
 #, python-format
 msgid "Next %(count)s"
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:62
+#: templates/item/item_add_cat_search.xhtml:65
 msgid "PubDate"
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:70
+#: templates/item/item_add_cat_search.xhtml:73
 msgid "details"
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:71
+#: templates/item/item_add_cat_search.xhtml:74
 msgid "Electronic resource."
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:72
+#: templates/item/item_add_cat_search.xhtml:75
 msgid "view"
 msgstr ""
 
-#: templates/item/item_add_cat_search.xhtml:82
+#: templates/item/item_add_cat_search.xhtml:85
 msgid "Pick this item"
 msgstr ""
 
@@ -1332,6 +1341,7 @@ msgstr ""
 msgid "Click here to download the document."
 msgstr ""
 
+#. Bytes will always be plural!
 #: templates/item/item_metadata.xhtml:113
 #, python-format
 msgid "Document type: %(type)s. Size: %(bytes)s bytes."
index 0b4ea55..455dbed 100644 (file)
@@ -7,7 +7,7 @@ from genshi.builder import tag
 import genshi.output
 from django.conf import settings
 from warnings import warn
-from django.utils.translation import ugettext
+import django.utils.translation
 
 try:
     from threading import local
@@ -31,7 +31,7 @@ def get_request():
 #---------------------------------------------------------------------------
 # Templating support
 
-translator = Translator(ugettext)
+translator = Translator(django.utils.translation)
 
 
 class TemplateSet(object):
index 431202c..aaa63dc 100644 (file)
@@ -15,3 +15,4 @@ from conifer.plumbing.hooksystem import gethook, callhook
 from conifer.syrup               import models
 from django.conf                 import settings
 from django.utils.translation    import ugettext as _
+from django.utils.translation    import ngettext
index e725c7e..faa3124 100644 (file)
@@ -46,12 +46,16 @@ dc_keys = ['dc:title', 'dc:creator', 'dc:publisher', 'dc:date']
     </form>
     <div py:def="page_control" py:if="results">
       <p>
-       <span i18n:msg="first,last,total">${start}&ndash;${min(numhits, start+limit-1)} of ${numhits} results.</span>
+       <span i18n:choose="numhits; first,last,total">
+         <i18n:singular>${numhits} result.</i18n:singular>
+         <i18n:plural>${start}&ndash;${min(numhits, start+limit-1)} of ${numhits} results.</i18n:plural>
+       </span>
        <span py:if="start-limit&gt;0">
-         <a href=".?query=${query}&amp;start=${start-limit}&amp;limit=${limit}" i18n:msg="count">Previous ${limit}</a>
          &bull;
+         <a href=".?query=${query}&amp;start=${start-limit}&amp;limit=${limit}" i18n:msg="count">Previous ${limit}</a>
        </span>
        <span py:if="start+limit&lt;numhits">
+         &bull;
          <a href=".?query=${query}&amp;start=${start+limit}&amp;limit=${limit}" i18n:msg="count">Next ${limit}</a>
        </span>
       </p>
index ee444d8..1440d29 100644 (file)
@@ -110,7 +110,7 @@ callnum = item.call_number()
       </div>
       <div id="downloadpanel">
        <p><a class="bigdownload" href="${item.item_download_url()}"><button onclick="location='${item.item_download_url()}';">Click here to download the document.</button></a></p>
-       <p i18n:msg="type,bytes">Document type: ${item.fileobj_mimetype}. Size: ${item.fileobj.size} bytes.</p>
+       <p i18n:msg="type,bytes" i18n:comment="Bytes will always be plural!">Document type: ${item.fileobj_mimetype}. Size: ${item.fileobj.size} bytes.</p>
        </div>
     </div>
 
index 6a54e84..ec696ea 100644 (file)
@@ -23,8 +23,12 @@ title = _('Search Results')
         alt="lock" title="This resource is access-controlled."/>
     
 
-    <h2 py:if="query_string" i18n:msg="query, num">
-        You searched for: <i>${query_string}.</i> Found ${len(results)} matches.
+    <h2 py:if="query_string">
+      <span i18n:msg="query">You searched for: <i>${query_string}.</i></span>
+      <span i18n:choose="len(results); num">
+       <i18n:singular>Found ${len(results)} match.</i18n:singular>
+       <i18n:plural>Found ${len(results)} matches.</i18n:plural>
+      </span>
     </h2>
   
     <tr py:if="results" py:def="pageheader()">