Chinese humanize number conversion

15 views
Skip to first unread message

Malte

unread,
May 2, 2016, 10:57:40 PM5/2/16
to Django users
Hi,

The Chinese humanization of numbers is not correct for large and very large numbers.
1.400.000 converts into 1.4 百万 but should be 140万
166,200,000,000 converts into 166.2十亿 but should be 1662亿
I just looked through the Django core code but couldn't find where that conversion takes place.

Where does all of that go down?

Simon Charette

unread,
May 3, 2016, 9:57:37 AM5/3/16
to Django users
Hi Malte,

The conversion takes place in the intword template filter[1].

The Chinese translation of the intword_converters can be found in the
locale directory of the humanize application[2].

These translations are handled over Transifex[3].

Cheers,
Simon

[1] https://github.com/django/django/blob/72ea289ab7f3a0c2c6dca7b2eb73f3117409f8f0/django/contrib/humanize/templatetags/humanize.py#L58-L138
[2] https://github.com/django/django/blob/master/django/contrib/humanize/locale/zh_Hans/LC_MESSAGES/django.po
[3] https://www.transifex.com/django/django/language/zh_CN/
Reply all
Reply to author
Forward
0 new messages