diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py
index d071c3a..ece9cb7 100644
a
|
b
|
from datetime import date, datetime, timedelta
|
4 | 4 | from django import template |
5 | 5 | from django.conf import settings |
6 | 6 | from django.template import defaultfilters |
| 7 | from django.utils.datastructures import SortedDict |
7 | 8 | from django.utils.encoding import force_unicode |
8 | 9 | from django.utils.formats import number_format |
9 | 10 | from django.utils.translation import pgettext, ungettext, ugettext as _ |
… |
… |
def intcomma(value, use_l10n=True):
|
51 | 52 | intcomma.is_safe = True |
52 | 53 | register.filter(intcomma) |
53 | 54 | |
54 | | # A dictionary of standard large number to their converters |
55 | | intword_converters = { |
56 | | 6: lambda number: ( |
| 55 | # A sorted dictionary of standard large number to their converters |
| 56 | intword_converters = SortedDict(( |
| 57 | (6, lambda number: ( |
57 | 58 | ungettext('%(value).1f million', '%(value).1f million', number), |
58 | 59 | ungettext('%(value)s million', '%(value)s million', number), |
59 | | ), |
60 | | 9: lambda number: ( |
| 60 | )), |
| 61 | (9, lambda number: ( |
61 | 62 | ungettext('%(value).1f billion', '%(value).1f billion', number), |
62 | 63 | ungettext('%(value)s billion', '%(value)s billion', number), |
63 | | ), |
64 | | 12: lambda number: ( |
| 64 | )), |
| 65 | (12, lambda number: ( |
65 | 66 | ungettext('%(value).1f trillion', '%(value).1f trillion', number), |
66 | 67 | ungettext('%(value)s trillion', '%(value)s trillion', number), |
67 | | ), |
68 | | 15: lambda number: ( |
| 68 | )), |
| 69 | (15, lambda number: ( |
69 | 70 | ungettext('%(value).1f quadrillion', '%(value).1f quadrillion', number), |
70 | 71 | ungettext('%(value)s quadrillion', '%(value)s quadrillion', number), |
71 | | ), |
72 | | 18: lambda number: ( |
| 72 | )), |
| 73 | (18, lambda number: ( |
73 | 74 | ungettext('%(value).1f quintillion', '%(value).1f quintillion', number), |
74 | 75 | ungettext('%(value)s quintillion', '%(value)s quintillion', number), |
75 | | ), |
76 | | 21: lambda number: ( |
| 76 | )), |
| 77 | (21, lambda number: ( |
77 | 78 | ungettext('%(value).1f sextillion', '%(value).1f sextillion', number), |
78 | 79 | ungettext('%(value)s sextillion', '%(value)s sextillion', number), |
79 | | ), |
80 | | 24: lambda number: ( |
| 80 | )), |
| 81 | (24, lambda number: ( |
81 | 82 | ungettext('%(value).1f septillion', '%(value).1f septillion', number), |
82 | 83 | ungettext('%(value)s septillion', '%(value)s septillion', number), |
83 | | ), |
84 | | 27: lambda number: ( |
| 84 | )), |
| 85 | (27, lambda number: ( |
85 | 86 | ungettext('%(value).1f octillion', '%(value).1f octillion', number), |
86 | 87 | ungettext('%(value)s octillion', '%(value)s octillion', number), |
87 | | ), |
88 | | 30: lambda number: ( |
| 88 | )), |
| 89 | (30, lambda number: ( |
89 | 90 | ungettext('%(value).1f nonillion', '%(value).1f nonillion', number), |
90 | 91 | ungettext('%(value)s nonillion', '%(value)s nonillion', number), |
91 | | ), |
92 | | 33: lambda number: ( |
| 92 | )), |
| 93 | (33, lambda number: ( |
93 | 94 | ungettext('%(value).1f decillion', '%(value).1f decillion', number), |
94 | 95 | ungettext('%(value)s decillion', '%(value)s decillion', number), |
95 | | ), |
96 | | 100: lambda number: ( |
| 96 | )), |
| 97 | (100, lambda number: ( |
97 | 98 | ungettext('%(value).1f googol', '%(value).1f googol', number), |
98 | 99 | ungettext('%(value)s googol', '%(value)s googol', number), |
99 | | ), |
100 | | } |
| 100 | )), |
| 101 | )) |
101 | 102 | |
102 | 103 | def intword(value): |
103 | 104 | """ |