Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use locale defined digits instead of 0-9 #731

Open
snoopyjc opened this issue Oct 1, 2020 · 3 comments
Open

Use locale defined digits instead of 0-9 #731

snoopyjc opened this issue Oct 1, 2020 · 3 comments

Comments

@snoopyjc
Copy link

snoopyjc commented Oct 1, 2020

I would like to use babel to convert numbers into locale-defined characters. For example in zh_TW, 1350 is represented as 一千三百五十. Your format_decimal(1350, locale='zh_TW') returns 1350.

@akx
Copy link
Member

akx commented Oct 1, 2020

This was somewhat implemented in #470 (which would need rebasing), but we'd also need to be very careful with backward compatibility; a Babel version upgrade can't have numbers start getting spelled differently...

Also ref #446

@snoopyjc
Copy link
Author

snoopyjc commented Oct 1, 2020

Thanks - it's not a 1-to-1 mapping though. For example, several languages (e.g. Chinese, which is also used in Japanese) have digits for 10, 100, 1000, etc, so you write 1350 as One Thousand (一千) Three Hundred (三百) Five Tens (五十). Ref: https://en.wikibooks.org/wiki/Chinese_(Mandarin)/Numbers

@snoopyjc
Copy link
Author

@akx maybe follow Excel’s lead where they add [DBNumN] to the number format to use locale digits, ie add an extra parameter to format_decimal to enable it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants