Created
October 5, 2010 13:47
-
-
Save patrys/611569 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load liczba_mnoga %} | |
<p>{% liczba_mnoga user_count "jedna osoba" "%(n)s osoby" "%(n)s osób" %}</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import template | |
register = template.Library() | |
@register.simple_tag | |
def liczba_mnoga(n, form1, form2, form5): | |
n = abs(n) | |
if n == 1: | |
return form1 % {'n': n} | |
if n % 10 >= 2 \ | |
and n % 10 <= 4 \ | |
and (n % 100 < 10 or n % 100 >= 20): | |
return form2 % {'n': n} | |
return form5 % {'n': n} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment