diff -r 983be4e9b98c django/views/i18n.py
a
|
b
|
def javascript_catalog(request, domain='
|
154 | 154 | # this should actually be a compiled function of a typical plural-form: |
155 | 155 | # Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2; |
156 | 156 | plural = [el.strip() for el in plural.split(';') if el.strip().startswith('plural=')][0].split('=',1)[1] |
157 | | src.append('function pluralidx(n) {\n return %s;\n}\n' % plural) |
| 157 | src.append(""" |
| 158 | function pluralidx(n) { |
| 159 | var v=%s; |
| 160 | if (typeof(v) == 'boolean') { |
| 161 | return v ? 1 : 0; |
| 162 | } else { |
| 163 | return v; |
| 164 | } |
| 165 | } |
| 166 | """ % plural) |
158 | 167 | else: |
159 | 168 | src.append(SimplePlural) |
160 | 169 | csrc = [] |