mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
defer i18n lookup of shortTimeTable
This commit is contained in:
parent
df98e8609e
commit
087533fbc5
1 changed files with 4 additions and 3 deletions
|
@ -43,14 +43,15 @@ afterTimeTable = {
|
|||
"seconds": lambda n: ngettext("%s second<!--after-->", "%s seconds<!--after-->", n),
|
||||
}
|
||||
|
||||
shortTimeTable = {
|
||||
def shortTimeFmt(type):
|
||||
return {
|
||||
"years": _("%sy"),
|
||||
"months": _("%smo"),
|
||||
"days": _("%sd"),
|
||||
"hours": _("%sh"),
|
||||
"minutes": _("%sm"),
|
||||
"seconds": _("%ss"),
|
||||
}
|
||||
}[type]
|
||||
|
||||
def fmtTimeSpan(time, pad=0, point=0, short=False, after=False, unit=99):
|
||||
"Return a string representing a time span (eg '2 days')."
|
||||
|
@ -59,7 +60,7 @@ def fmtTimeSpan(time, pad=0, point=0, short=False, after=False, unit=99):
|
|||
if not point:
|
||||
time = math.floor(time)
|
||||
if short:
|
||||
fmt = shortTimeTable[type]
|
||||
fmt = shortTimeFmt(type)
|
||||
else:
|
||||
if after:
|
||||
fmt = afterTimeTable[type](_pluralCount(time, point))
|
||||
|
|
Loading…
Reference in a new issue