mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
fix time translation patch
This commit is contained in:
parent
fcccf12ba6
commit
c67fc3e769
2 changed files with 9 additions and 2 deletions
|
@ -69,8 +69,8 @@ def fmtTimeSpan(time, pad=0, point=0, short=False, inTime=False, unit=99):
|
|||
fmt = inTimeTable[type](_pluralCount(time, point))
|
||||
else:
|
||||
fmt = timeTable[type](_pluralCount(time, point))
|
||||
timestr = "%(a)d.%(b)df" % {'a': pad, 'b': point}
|
||||
return locale.format_string("%" + (fmt % timestr), time)
|
||||
timestr = "%%%(a)d.%(b)df" % {'a': pad, 'b': point}
|
||||
return locale.format_string(fmt % timestr, time)
|
||||
|
||||
def optimalPeriod(time, point, unit):
|
||||
if abs(time) < 60 or unit < 1:
|
||||
|
|
7
tests/test_utils.py
Normal file
7
tests/test_utils.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
# coding: utf-8
|
||||
|
||||
from anki.utils import fmtTimeSpan
|
||||
|
||||
def test_fmtTimeSpan():
|
||||
assert fmtTimeSpan(5) == "5 seconds"
|
||||
assert fmtTimeSpan(5, inTime=True) == "in 5 seconds"
|
Loading…
Reference in a new issue