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

ICU-21109 minimum grouping digits in DecimalFormat #1152

Merged
merged 1 commit into from
Jun 11, 2020

Conversation

FrankYFTang
Copy link
Contributor

Enhance DecimalFormat::setMinimumGroupingDigits to accept
UNUM_MINIMUM_GROUPING_DIGITS_AUTO and
UNUM_MINIMUM_GROUPING_DIGITS_MIN2 to support locale default
for minimum grouping digits

Checklist

@FrankYFTang FrankYFTang force-pushed the 21109-minimum-grouping branch from 2b334aa to 843aeb1 Compare May 27, 2020 18:24
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • icu4c/source/i18n/unicode/decimfmt.h is different
  • icu4c/source/i18n/unicode/unum.h is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@FrankYFTang FrankYFTang requested a review from sffc May 27, 2020 18:27
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

Can you also make this change in Java, at least the code change? We can't pass enums as ints in Java, so it may not require an API proposal, but we should at least make behavior the same.

icu4c/source/i18n/unicode/decimfmt.h Outdated Show resolved Hide resolved
Copy link

@hixio-mh hixio-mh left a comment

Choose a reason for hiding this comment

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

request changes

Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

Okay. I guess best practice would be to send an update to your API proposal, and add this to the Java API docs. It should be painless.

}

if (this.grouping1 != -2 && this.grouping2 != -4) {
return getInstance(this.grouping1, this.grouping2, minGrouping);
Copy link
Member

Choose a reason for hiding this comment

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

Return this if minGrouping == this.minGrouping

*
* @see #setMinimumGroupingDigits
* @see #MINIMUM_GROUPING_DIGITS_MIN2
* @draft ICU 68
Copy link
Member

Choose a reason for hiding this comment

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

Please put these in the @category, and add the provisional tag.

Comment on lines 1998 to 2007
* Setting the value to 1 to turn off minimum grouping digits.
* Setting the value to MINIMUM_GROUPING_DIGITS_AUTO to display grouping using the default
* strategy for all locales.
* Setting the value to MINIMUM_GROUPING_DIGITS_MIN2 to display grouping using locale defaults,
* except do not show grouping on values smaller than 10000 (such that there is a minimum of
* two digits before the first separator).
*
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Setting the value to 1 to turn off minimum grouping digits.
* Setting the value to MINIMUM_GROUPING_DIGITS_AUTO to display grouping using the default
* strategy for all locales.
* Setting the value to MINIMUM_GROUPING_DIGITS_MIN2 to display grouping using locale defaults,
* except do not show grouping on values smaller than 10000 (such that there is a minimum of
* two digits before the first separator).
*
* Set the value to:
* <ul>
* <li>1 to turn off minimum grouping digits.</li>
* <li>MINIMUM_GROUPING_DIGITS_AUTO to display grouping using the default
* strategy for all locales.</li>
* <li>MINIMUM_GROUPING_DIGITS_MIN2 to display grouping using locale defaults,
* except do not show grouping on values smaller than 10000 (such that there is a minimum of
* two digits before the first separator).</li>
* </ul>

@FrankYFTang
Copy link
Contributor Author

PTAL

@sffc
Copy link
Member

sffc commented Jun 11, 2020

Ok. Lgtm. Please squash and I'll approve.

@FrankYFTang FrankYFTang force-pushed the 21109-minimum-grouping branch from 08f9a1f to dd8aa11 Compare June 11, 2020 17:30
@jira-pull-request-webhook
Copy link

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@FrankYFTang FrankYFTang merged commit e7bd5b1 into unicode-org:master Jun 11, 2020
@FrankYFTang FrankYFTang deleted the 21109-minimum-grouping branch June 11, 2020 21:32
pull bot pushed a commit to Alan-love/chromium that referenced this pull request Jun 13, 2020
Cherry-pick pull/1152to fix minimum group digits

Needed to fix Minimum Grouping Digits for Intl.RelativeTimeFormat
Add ability to use locale default for minimum grouping digits
 - patches/grouping_digits.patch
 - upstream PR:
   unicode-org/icu#1152
 - upbstream bug:
   https://unicode-org.atlassian.net/browse/ICU-21109

https://chromium.googlesource.com/chromium/deps/icu.git/+log/46f53df..9e7dae8

9e7dae8 Cherry-pick pull/1152to fix minimum group digits
e4b8586 Remove *.mk files which no longer exist
c981f19 Sort the list in the filter files w/o changes

All these three has no dat size impact.

Bug: v8:10443
Change-Id: I3b4e32fae2e50c804bc906c5e279f198b35ad752
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2242745
Reviewed-by: Jungshik Shin <jshin@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#777959}
kishiguro pushed a commit to kishiguro/icu that referenced this pull request Jun 16, 2020
Needed to fix Minimum Grouping Digits for Intl.RelativeTimeFormat
Add ability to use locale default for minimum grouping digits
 - patches/grouping_digits.patch
 - upstream PR:
   unicode-org/icu#1152
 - upbstream bug:
   https://unicode-org.atlassian.net/browse/ICU-21109

Bug: v8:10443
Change-Id: I5f9f627d8be5cca42d842a4bef4661b29efd060f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/deps/icu/+/2242106
Reviewed-by: Jungshik Shin <jshin@chromium.org>
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.

3 participants