Skip to content

Use locale defined digits instead of 0-9 #731

Description

@snoopyjc

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.

Activity

  1. akx commented on Oct 1, 2020

    @akx
    Member

    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

  2. snoopyjc commented on Oct 1, 2020

    @snoopyjc
    Author

    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

  3. snoopyjc commented on Oct 11, 2020

    @snoopyjc
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions