more ngettext references

This commit is contained in:
Damien Elmes 2020-11-18 10:52:13 +10:00
parent 1255e7530c
commit b49805fef5
6 changed files with 10 additions and 41 deletions

View File

@ -634,14 +634,7 @@ class CardLayout(QDialog):
def onAddCard(self):
cnt = self.mw.col.models.useCount(self.model)
txt = (
ngettext(
"This will create %d card. Proceed?",
"This will create %d cards. Proceed?",
cnt,
)
% cnt
)
txt = tr(TR.CARD_TEMPLATES_THIS_WILL_CREATE_CARD_PROCEED, count=cnt)
if not askUser(txt):
return
if not self.change_tracker.mark_schema():

View File

@ -164,10 +164,7 @@ class DeckConf(QDialog):
continue
deck["conf"] = self.deck["conf"]
self.mw.col.decks.save(deck)
tooltip(
ngettext("%d deck updated.", "%d decks updated.", len(self.childDids))
% len(self.childDids)
)
tooltip(tr(TR.SCHEDULING_DECK_UPDATED, count=len(self.childDids)))
# Loading
##################################################

View File

@ -150,10 +150,7 @@ class ExportDialog(QDialog):
def exported_media(cnt):
self.mw.taskman.run_on_main(
lambda: self.mw.progress.update(
label=ngettext(
"Exported %d media file", "Exported %d media files", cnt
)
% cnt
label=tr(TR.EXPORTING_EXPORTED_MEDIA_FILE, count=cnt)
)
)
@ -178,22 +175,8 @@ class ExportDialog(QDialog):
self.mw.reopen()
else:
if self.isTextNote:
msg = (
ngettext(
"%d note exported.",
"%d notes exported.",
self.exporter.count,
)
% self.exporter.count
)
msg = tr(TR.EXPORTING_NOTE_EXPORTED, count=self.exporter.count)
else:
msg = (
ngettext(
"%d card exported.",
"%d cards exported.",
self.exporter.count,
)
% self.exporter.count
)
msg = tr(TR.EXPORTING_CARD_EXPORTED, count=self.exporter.count)
tooltip(msg, period=3000)
QDialog.reject(self)

View File

@ -482,8 +482,7 @@ def _replaceWithApkg(mw, filename, backup):
):
mw.taskman.run_on_main(
lambda n=n: mw.progress.update(
ngettext("Processed %d media file", "Processed %d media files", n)
% n
tr(TR.IMPORTING_PROCESSED_MEDIA_FILE, count=n)
)
)
size = z.getinfo(cStr).file_size

View File

@ -822,12 +822,7 @@ time = %(time)d;
cnt = len(self.card.note().cards())
self.mw.col.remove_notes([self.card.note().id])
self.mw.reset()
tooltip(
ngettext(
"Note and its %d card deleted.", "Note and its %d cards deleted.", cnt
)
% cnt
)
tooltip(tr(TR.STUDYING_NOTE_AND_ITS_CARD_DELETED, count=cnt))
def onBuryCard(self) -> None:
self.mw.checkpoint(tr(TR.STUDYING_BURY))

View File

@ -7,7 +7,9 @@ files = (
glob.glob("../../qt/**/*.py", recursive=True)
# glob.glob("../../qt/**/forms/*.ui", recursive=True)
)
string_re = re.compile(r'ngettext\(\s*"(.+?)",\s+".+?",\s+(.+?)\) % \2', re.DOTALL)
string_re = re.compile(
r'ngettext\(\s*"(.+?)",\s+".+?",\s+(.+?)\s*,?\s*\)\s+%\s+\2', re.DOTALL
)
map = json.load(open("keys_by_text.json"))