added pluralization in a number of spots

This commit is contained in:
Soren Bjornstad 2012-09-09 17:07:47 -05:00
parent b436c46b18
commit 1f7c19f535
5 changed files with 14 additions and 8 deletions

View file

@ -6,6 +6,7 @@ from anki import Collection
from anki.utils import intTime
from anki.importing.base import Importer
from anki.lang import _
from anki.lang import ngettext
#
# Import a .anki2 file into the current collection. Used for migration from
@ -254,7 +255,7 @@ class Anki2Importer(Importer):
insert or ignore into cards values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""", cards)
self.dst.db.executemany("""
insert or ignore into revlog values (?,?,?,?,?,?,?,?,?)""", revlog)
self.log.append(_("%d cards imported.") % cnt)
self.log.append(ngettext("%d card imported.", "%d cards imported.", cnt) % cnt)
# Media
######################################################################

View file

@ -9,6 +9,7 @@ from anki.importing.noteimp import NoteImporter, ForeignNote, ForeignCard
from anki.utils import checksum, base91
from anki.stdmodels import addBasicModel
from anki.lang import _
from anki.lang import ngettext
class MnemosyneImporter(NoteImporter):
@ -83,7 +84,7 @@ acq_reps+ret_reps, lapses from cards"""):
total += self.total
self._addVocabulary(vocabulary)
self.total += total
self.log.append(_("%d notes imported.") % self.total)
self.log.append(ngettext("%d note imported.", "%d notes imported.", self.total) % self.total)
def fields(self):
return self._fields

View file

@ -8,6 +8,7 @@ from anki.utils import fieldChecksum, ids2str, guid64, timestampID, \
joinFields, intTime, splitFields
from anki.errors import *
from anki.importing.base import Importer
from anki.lang import ngettext
# Stores a list of fields, tags and deck
######################################################################
@ -150,8 +151,10 @@ class NoteImporter(Importer):
# apply scheduling updates
self.updateCards()
# make sure to update sflds, etc
self.log.append(_("%(a)d notes added, %(b)d notes updated.") %
dict(a=len(new), b=self.updateCount))
part1 = ngettext("%d note added", "%d notes added", len(new)) % len(new)
part2 = ngettext("%d note updated", "%d notes updated", self.updateCount) % self.updateCount
self.log.append("%s, %s." % (part1, part2))
self.total = len(self._ids)
def newData(self, n):

View file

@ -7,6 +7,7 @@ import sys
from anki.stdmodels import addBasicModel
from anki.importing.noteimp import NoteImporter, ForeignNote, ForeignCard
from anki.lang import _
from anki.lang import ngettext
from anki.errors import *
from xml.dom import minidom, Node
@ -214,7 +215,7 @@ class SupermemoXmlImporter(NoteImporter):
# Return imported cards
self.total = len(self.notes)
self.log.append(_("%d cards imported.") % self.total)
self.log.append(ngettext("%d card imported.", "%d cards imported.", self.total) % self.total)
return self.notes
def fields(self):

View file

@ -169,7 +169,7 @@ h1 { margin-bottom: 0; margin-top: 1em; }
def _dueInfo(self, tot, num):
i = []
self._line(i, _("Total"), _("%d reviews") % tot)
self._line(i, _("Total"), ngettext("%d review", "%d reviews", tot) % tot)
self._line(i, _("Average"), self._avgDay(
tot, num, _("reviews")))
return self._lineTbl(i)
@ -289,8 +289,8 @@ group by day order by day""" % (self._limit(), lim),
if total and tot:
self._line(
i, _("Average answer time"),
_("%(a)0.1fs (%(b)d cards/minute)") % dict(
a=(tot*60)/total, b=(total / float(tot))))
ngettext("%0.1fs (%d card/minute)", "%0.1fs (%d cards/minute)", \
(total / float(tot))) % ((tot*60)/total, total / float(tot)) )
return self._lineTbl(i), int(tot)
def _splitRepData(self, data, spec):