Skip to content
Snippets Groups Projects
Commit fdaf5ada authored by Martin Mareš's avatar Martin Mareš
Browse files

Přidáno inflect_by_number (podobně jako inflect_number, ale bez čísla)

parent 57fd5862
No related branches found
No related tags found
3 merge requests!19Reforma vyhodnocování práv,!18Dávky okolo feedbacku,!17Výsledkovka pomocí mo.web.table
This commit is part of merge request !17. Comments created here will be created in the context of that merge request.
......@@ -15,6 +15,15 @@ def inflect_number(n: int, w1: str, w234: str, wother: str, unitprefix: str = ''
return f'{n} {unitprefix}{wother}'
def inflect_by_number(n: int, w1: str, w234: str, wother: str, unitprefix: str = '') -> str:
if n == 1:
return f'{unitprefix}{w1}'
elif 2 <= n <= 4:
return f'{unitprefix}{w234}'
else:
return f'{unitprefix}{wother}'
def timeformat(dt: datetime) -> str:
if dt is None:
return ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment