mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1738422 - Part 9: Add a separate UNumberFormatFields constant for the approximately sign. r=platform-i18n-reviewers,dminor
Our previous heuristic no longer works, so we now have to patch ICU directly to support detecting the approximately sign. Depends on D129930 Differential Revision: https://phabricator.services.mozilla.com/D129931
This commit is contained in:
parent
d8de6ee81b
commit
2e3c881a95
56
intl/icu-patches/bug-1738422-approximately-sign.diff
Normal file
56
intl/icu-patches/bug-1738422-approximately-sign.diff
Normal file
@ -0,0 +1,56 @@
|
||||
# Add a new UNumberFormatFields constant for the approximately sign.
|
||||
#
|
||||
# https://unicode-org.atlassian.net/browse/ICU-21765
|
||||
|
||||
|
||||
diff --git a/intl/icu/source/i18n/number_affixutils.cpp b/intl/icu/source/i18n/number_affixutils.cpp
|
||||
--- a/intl/icu/source/i18n/number_affixutils.cpp
|
||||
+++ b/intl/icu/source/i18n/number_affixutils.cpp
|
||||
@@ -131,17 +131,17 @@ UnicodeString AffixUtils::escape(const U
|
||||
Field AffixUtils::getFieldForType(AffixPatternType type) {
|
||||
switch (type) {
|
||||
case TYPE_MINUS_SIGN:
|
||||
return {UFIELD_CATEGORY_NUMBER, UNUM_SIGN_FIELD};
|
||||
case TYPE_PLUS_SIGN:
|
||||
return {UFIELD_CATEGORY_NUMBER, UNUM_SIGN_FIELD};
|
||||
case TYPE_APPROXIMATELY_SIGN:
|
||||
// TODO: Introduce a new field for the approximately sign?
|
||||
- return {UFIELD_CATEGORY_NUMBER, UNUM_SIGN_FIELD};
|
||||
+ return {UFIELD_CATEGORY_NUMBER, UNUM_APPROXIMATELY_SIGN_FIELD};
|
||||
case TYPE_PERCENT:
|
||||
return {UFIELD_CATEGORY_NUMBER, UNUM_PERCENT_FIELD};
|
||||
case TYPE_PERMILLE:
|
||||
return {UFIELD_CATEGORY_NUMBER, UNUM_PERMILL_FIELD};
|
||||
case TYPE_CURRENCY_SINGLE:
|
||||
return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD};
|
||||
case TYPE_CURRENCY_DOUBLE:
|
||||
return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD};
|
||||
diff --git a/intl/icu/source/i18n/unicode/unum.h b/intl/icu/source/i18n/unicode/unum.h
|
||||
--- a/intl/icu/source/i18n/unicode/unum.h
|
||||
+++ b/intl/icu/source/i18n/unicode/unum.h
|
||||
@@ -397,22 +397,24 @@ typedef enum UNumberFormatFields {
|
||||
UNUM_PERMILL_FIELD,
|
||||
/** @stable ICU 49 */
|
||||
UNUM_SIGN_FIELD,
|
||||
/** @stable ICU 64 */
|
||||
UNUM_MEASURE_UNIT_FIELD,
|
||||
/** @stable ICU 64 */
|
||||
UNUM_COMPACT_FIELD,
|
||||
|
||||
+ UNUM_APPROXIMATELY_SIGN_FIELD,
|
||||
+
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* One more than the highest normal UNumberFormatFields value.
|
||||
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
||||
*/
|
||||
- UNUM_FIELD_COUNT = UNUM_SIGN_FIELD + 3
|
||||
+ UNUM_FIELD_COUNT = UNUM_SIGN_FIELD + 4
|
||||
#endif /* U_HIDE_DEPRECATED_API */
|
||||
} UNumberFormatFields;
|
||||
|
||||
|
||||
/**
|
||||
* Selectors with special numeric values to use locale default minimum grouping
|
||||
* digits for the DecimalFormat/UNumberFormat setMinimumGroupingDigits method.
|
||||
* Do not use these constants with the [U]NumberFormatter API.
|
@ -136,7 +136,7 @@ Field AffixUtils::getFieldForType(AffixPatternType type) {
|
||||
return {UFIELD_CATEGORY_NUMBER, UNUM_SIGN_FIELD};
|
||||
case TYPE_APPROXIMATELY_SIGN:
|
||||
// TODO: Introduce a new field for the approximately sign?
|
||||
return {UFIELD_CATEGORY_NUMBER, UNUM_SIGN_FIELD};
|
||||
return {UFIELD_CATEGORY_NUMBER, UNUM_APPROXIMATELY_SIGN_FIELD};
|
||||
case TYPE_PERCENT:
|
||||
return {UFIELD_CATEGORY_NUMBER, UNUM_PERCENT_FIELD};
|
||||
case TYPE_PERMILLE:
|
||||
|
@ -402,12 +402,14 @@ typedef enum UNumberFormatFields {
|
||||
/** @stable ICU 64 */
|
||||
UNUM_COMPACT_FIELD,
|
||||
|
||||
UNUM_APPROXIMATELY_SIGN_FIELD,
|
||||
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* One more than the highest normal UNumberFormatFields value.
|
||||
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
||||
*/
|
||||
UNUM_FIELD_COUNT = UNUM_SIGN_FIELD + 3
|
||||
UNUM_FIELD_COUNT = UNUM_SIGN_FIELD + 4
|
||||
#endif /* U_HIDE_DEPRECATED_API */
|
||||
} UNumberFormatFields;
|
||||
|
||||
|
@ -57,6 +57,7 @@ for patch in \
|
||||
bug-1636984-display-name-fractional-seconds.diff \
|
||||
bug-1636984-append-item-dayperiod-fractional-seconds.diff \
|
||||
bug-1706949-wasi-workaround.diff \
|
||||
bug-1738422-approximately-sign.diff \
|
||||
; do
|
||||
echo "Applying local patch $patch"
|
||||
patch -d ${icu_dir}/../../ -p1 --no-backup-if-mismatch < ${icu_dir}/../icu-patches/$patch
|
||||
|
Loading…
Reference in New Issue
Block a user