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

Added group_separator feature in number formatting #726

Merged
merged 4 commits into from
Sep 22, 2020

Conversation

Abdullahjavednesar
Copy link
Contributor

@Abdullahjavednesar Abdullahjavednesar commented Aug 21, 2020

Added a new group_separator feature in number formatting. group_separator is a Boolean parameter default set as True, when False, it simply means the output should be free of group separator.
Example:

format_decimal(23434567890567.1224, locale='fr_CA', group_separator=False)
>>> '23434567890567,12'

Default behaviour remains unchanged.
Example:

format_decimal(23434567890567.1224, locale='en_US')
>>> '23,434,567,890,567.12

@codecov-commenter
Copy link

codecov-commenter commented Aug 21, 2020

Codecov Report

Merging #726 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #726   +/-   ##
=======================================
  Coverage   90.97%   90.97%           
=======================================
  Files          24       24           
  Lines        4176     4179    +3     
=======================================
+ Hits         3799     3802    +3     
  Misses        377      377           
Impacted Files Coverage Δ
babel/numbers.py 97.70% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e7e4265...e25546f. Read the comment docs.

@Abdullahjavednesar
Copy link
Contributor Author

Abdullahjavednesar commented Aug 21, 2020

@akx @kdeldycke please have a look.

@kdeldycke
Copy link
Contributor

Looks nice @Abdullahjavednesar!

Can you add some test to demonstrates the use of explicit group_separator=True? That way we can make sure group_separator is properly recognize.

It might also be great to have the docstrings updated so we can have that new option documented for end-users.

@Abdullahjavednesar
Copy link
Contributor Author

Hi @kdeldycke, thanks for the review.

Can you add some test to demonstrates the use of explicit group_separator=True? That way we can make sure group_separator is properly recognize.

Sure, will add more tests to cover those too.

It might also be great to have the docstrings updated so we can have that new option documented for end-users.

Yes, makes sense, I'll update the docstrings.

@Abdullahjavednesar Abdullahjavednesar force-pushed the group_separator branch 2 times, most recently from 4e745b4 to f6e4b2d Compare September 12, 2020 16:25
@Abdullahjavednesar
Copy link
Contributor Author

Hi @kdeldycke @akx please have a look. If looks good, can this be merged?

@kdeldycke
Copy link
Contributor

LGTM! Thanks @Abdullahjavednesar for your contribution! I'm no official maintainer though, I just added a couple of features in the same spirit as yours, and as a fellow contributor I find it great! :)

Now we need a review and eventual merge decision from an official maintainer.

@Abdullahjavednesar
Copy link
Contributor Author

Thanks a lot @kdeldycke for your reviews, and those good words. Indeed Open source is a great platform to work and learn collaboratively :)

@akx a request if you could please review this :)

Copy link
Member

@akx akx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine by me, though I'd like to know what the actual use case for this is :)

@akx akx merged commit e0e6aa6 into python-babel:master Sep 22, 2020
@Abdullahjavednesar
Copy link
Contributor Author

Thanks @akx for merging :)

We came across this use case where we had to export files with Amount column and amount should just have a fraction symbol and not the group symbol. I believe this would be the cleanest approach so I've added this feature to all applicable functions.

Thanks again @kdeldycke @akx :)

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

Successfully merging this pull request may close these issues.

4 participants