mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 23:42:23 -04:00
split "Due" into three different contexts for translators
This commit is contained in:
parent
771452c227
commit
1524e7dcac
7 changed files with 34 additions and 6 deletions
|
@ -19,6 +19,8 @@ enum StringsGroup {
|
||||||
CARD_TEMPLATES = 3;
|
CARD_TEMPLATES = 3;
|
||||||
SYNC = 4;
|
SYNC = 4;
|
||||||
NETWORK = 5;
|
NETWORK = 5;
|
||||||
|
STATISTICS = 6;
|
||||||
|
FILTERING = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1-15 reserved for future use; 2047 for errors
|
// 1-15 reserved for future use; 2047 for errors
|
||||||
|
|
|
@ -6,8 +6,10 @@ import json
|
||||||
import time
|
import time
|
||||||
from typing import Any, Dict, List, Optional, Tuple
|
from typing import Any, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
|
import anki
|
||||||
from anki.consts import *
|
from anki.consts import *
|
||||||
from anki.lang import _, ngettext
|
from anki.lang import _, ngettext
|
||||||
|
from anki.rsbackend import StringsGroup
|
||||||
from anki.utils import fmtTimeSpan, ids2str
|
from anki.utils import fmtTimeSpan, ids2str
|
||||||
|
|
||||||
# Card stats
|
# Card stats
|
||||||
|
@ -19,7 +21,7 @@ PERIOD_LIFE = 2
|
||||||
|
|
||||||
|
|
||||||
class CardStats:
|
class CardStats:
|
||||||
def __init__(self, col, card) -> None:
|
def __init__(self, col: anki.storage._Collection, card: anki.cards.Card) -> None:
|
||||||
self.col = col
|
self.col = col
|
||||||
self.card = card
|
self.card = card
|
||||||
self.txt = ""
|
self.txt = ""
|
||||||
|
@ -45,7 +47,10 @@ class CardStats:
|
||||||
next = c.due
|
next = c.due
|
||||||
next = self.date(next)
|
next = self.date(next)
|
||||||
if next:
|
if next:
|
||||||
self.addLine(_("Due"), next)
|
self.addLine(
|
||||||
|
self.col.backend.translate(StringsGroup.STATISTICS, "due-date"),
|
||||||
|
next,
|
||||||
|
)
|
||||||
if c.queue == QUEUE_TYPE_REV:
|
if c.queue == QUEUE_TYPE_REV:
|
||||||
self.addLine(_("Interval"), fmt(c.ivl * 86400))
|
self.addLine(_("Interval"), fmt(c.ivl * 86400))
|
||||||
self.addLine(_("Ease"), "%d%%" % (c.factor / 10.0))
|
self.addLine(_("Ease"), "%d%%" % (c.factor / 10.0))
|
||||||
|
|
|
@ -24,6 +24,7 @@ from anki.consts import *
|
||||||
from anki.lang import _, ngettext
|
from anki.lang import _, ngettext
|
||||||
from anki.models import NoteType
|
from anki.models import NoteType
|
||||||
from anki.notes import Note
|
from anki.notes import Note
|
||||||
|
from anki.rsbackend import StringsGroup
|
||||||
from anki.utils import fmtTimeSpan, htmlToTextLine, ids2str, intTime, isMac, isWin
|
from anki.utils import fmtTimeSpan, htmlToTextLine, ids2str, intTime, isMac, isWin
|
||||||
from aqt import AnkiQt, gui_hooks
|
from aqt import AnkiQt, gui_hooks
|
||||||
from aqt.editor import Editor
|
from aqt.editor import Editor
|
||||||
|
@ -51,6 +52,7 @@ from aqt.utils import (
|
||||||
showInfo,
|
showInfo,
|
||||||
showWarning,
|
showWarning,
|
||||||
tooltip,
|
tooltip,
|
||||||
|
tr,
|
||||||
)
|
)
|
||||||
from aqt.webview import AnkiWebView
|
from aqt.webview import AnkiWebView
|
||||||
|
|
||||||
|
@ -728,7 +730,7 @@ class Browser(QMainWindow):
|
||||||
("noteCrt", _("Created")),
|
("noteCrt", _("Created")),
|
||||||
("noteMod", _("Edited")),
|
("noteMod", _("Edited")),
|
||||||
("cardMod", _("Changed")),
|
("cardMod", _("Changed")),
|
||||||
("cardDue", _("Due")),
|
("cardDue", tr(StringsGroup.STATISTICS, "due-date")),
|
||||||
("cardIvl", _("Interval")),
|
("cardIvl", _("Interval")),
|
||||||
("cardEase", _("Ease")),
|
("cardEase", _("Ease")),
|
||||||
("cardReps", _("Reviews")),
|
("cardReps", _("Reviews")),
|
||||||
|
@ -1269,7 +1271,7 @@ by clicking on one on the left."""
|
||||||
(_("New"), "is:new"),
|
(_("New"), "is:new"),
|
||||||
(_("Learning"), "is:learn"),
|
(_("Learning"), "is:learn"),
|
||||||
(_("Review"), "is:review"),
|
(_("Review"), "is:review"),
|
||||||
(_("Due"), "is:due"),
|
(tr(StringsGroup.FILTERING, "is-due"), "is:due"),
|
||||||
None,
|
None,
|
||||||
(_("Suspended"), "is:suspended"),
|
(_("Suspended"), "is:suspended"),
|
||||||
(_("Buried"), "is:buried"),
|
(_("Buried"), "is:buried"),
|
||||||
|
|
|
@ -10,12 +10,21 @@ from typing import Any
|
||||||
import aqt
|
import aqt
|
||||||
from anki.errors import DeckRenameError
|
from anki.errors import DeckRenameError
|
||||||
from anki.lang import _, ngettext
|
from anki.lang import _, ngettext
|
||||||
|
from anki.rsbackend import StringsGroup
|
||||||
from anki.utils import fmtTimeSpan, ids2str
|
from anki.utils import fmtTimeSpan, ids2str
|
||||||
from aqt import AnkiQt, gui_hooks
|
from aqt import AnkiQt, gui_hooks
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
from aqt.sound import av_player
|
from aqt.sound import av_player
|
||||||
from aqt.toolbar import BottomBar
|
from aqt.toolbar import BottomBar
|
||||||
from aqt.utils import askUser, getOnlyText, openHelp, openLink, shortcut, showWarning
|
from aqt.utils import (
|
||||||
|
askUser,
|
||||||
|
getOnlyText,
|
||||||
|
openHelp,
|
||||||
|
openLink,
|
||||||
|
shortcut,
|
||||||
|
showWarning,
|
||||||
|
tr,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class DeckBrowserBottomBar:
|
class DeckBrowserBottomBar:
|
||||||
|
@ -160,7 +169,7 @@ where id > ?""",
|
||||||
<tr><th colspan=5 align=left>%s</th><th class=count>%s</th>
|
<tr><th colspan=5 align=left>%s</th><th class=count>%s</th>
|
||||||
<th class=count>%s</th><th class=optscol></th></tr>""" % (
|
<th class=count>%s</th><th class=optscol></th></tr>""" % (
|
||||||
_("Deck"),
|
_("Deck"),
|
||||||
_("Due"),
|
tr(StringsGroup.STATISTICS, "due-count"),
|
||||||
_("New"),
|
_("New"),
|
||||||
)
|
)
|
||||||
buf += self._topLevelDragRow()
|
buf += self._topLevelDragRow()
|
||||||
|
|
2
rslib/src/i18n/filtering.ftl
Normal file
2
rslib/src/i18n/filtering.ftl
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# True if a card is due/ready for review
|
||||||
|
is-due = Due
|
|
@ -57,6 +57,8 @@ fn ftl_fallback_for_group(group: StringsGroup) -> String {
|
||||||
StringsGroup::CardTemplates => include_str!("card-template-rendering.ftl"),
|
StringsGroup::CardTemplates => include_str!("card-template-rendering.ftl"),
|
||||||
StringsGroup::Sync => include_str!("sync.ftl"),
|
StringsGroup::Sync => include_str!("sync.ftl"),
|
||||||
StringsGroup::Network => include_str!("network.ftl"),
|
StringsGroup::Network => include_str!("network.ftl"),
|
||||||
|
StringsGroup::Statistics => include_str!("statistics.ftl"),
|
||||||
|
StringsGroup::Filtering => include_str!("filtering.ftl"),
|
||||||
}
|
}
|
||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
|
@ -71,6 +73,8 @@ fn localized_ftl_for_group(group: StringsGroup, lang_ftl_folder: &Path) -> Optio
|
||||||
StringsGroup::CardTemplates => "card-template-rendering.ftl",
|
StringsGroup::CardTemplates => "card-template-rendering.ftl",
|
||||||
StringsGroup::Sync => "sync.ftl",
|
StringsGroup::Sync => "sync.ftl",
|
||||||
StringsGroup::Network => "network.ftl",
|
StringsGroup::Network => "network.ftl",
|
||||||
|
StringsGroup::Statistics => "statistics.ftl",
|
||||||
|
StringsGroup::Filtering => "filtering.ftl",
|
||||||
});
|
});
|
||||||
fs::read_to_string(&path)
|
fs::read_to_string(&path)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
|
|
4
rslib/src/i18n/statistics.ftl
Normal file
4
rslib/src/i18n/statistics.ftl
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# The date a card will be ready to review
|
||||||
|
due-date = Due
|
||||||
|
# The count of cards waiting to be reviewed
|
||||||
|
due-count = Due
|
Loading…
Reference in a new issue