diff --git a/qt/aqt/clayout.py b/qt/aqt/clayout.py index af19e1a41..55a26d7ed 100644 --- a/qt/aqt/clayout.py +++ b/qt/aqt/clayout.py @@ -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(): diff --git a/qt/aqt/deckconf.py b/qt/aqt/deckconf.py index 3c73d712a..8c3af16f6 100644 --- a/qt/aqt/deckconf.py +++ b/qt/aqt/deckconf.py @@ -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 ################################################## diff --git a/qt/aqt/exporting.py b/qt/aqt/exporting.py index 78714b5d3..a4c0d0b3c 100644 --- a/qt/aqt/exporting.py +++ b/qt/aqt/exporting.py @@ -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) diff --git a/qt/aqt/importing.py b/qt/aqt/importing.py index 5abaa43a4..176a9e78e 100644 --- a/qt/aqt/importing.py +++ b/qt/aqt/importing.py @@ -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 diff --git a/qt/aqt/reviewer.py b/qt/aqt/reviewer.py index 85f187093..7b81e92ed 100644 --- a/qt/aqt/reviewer.py +++ b/qt/aqt/reviewer.py @@ -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)) diff --git a/qt/po/scripts/rewrite-refs.py b/qt/po/scripts/rewrite-refs.py index 96be38501..5bcfce179 100644 --- a/qt/po/scripts/rewrite-refs.py +++ b/qt/po/scripts/rewrite-refs.py @@ -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"))