mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-19 14:57:32 +09:00
Issue #1971 - Part 2: Update ICU source to 63.2.
This commit is contained in:
parent
8df84683be
commit
1e69214382
3160 changed files with 275815 additions and 234203 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
|
|
@ -31,6 +31,7 @@
|
|||
#include "unicode/decimfmt.h"
|
||||
#include "unicode/localpointer.h"
|
||||
#include "unicode/msgfmt.h"
|
||||
#include "unicode/numberformatter.h"
|
||||
#include "unicode/plurfmt.h"
|
||||
#include "unicode/rbnf.h"
|
||||
#include "unicode/selfmt.h"
|
||||
|
|
@ -48,7 +49,7 @@
|
|||
#include "ustrfmt.h"
|
||||
#include "util.h"
|
||||
#include "uvector.h"
|
||||
#include "visibledigits.h"
|
||||
#include "number_decimalquantity.h"
|
||||
|
||||
// *****************************************************************************
|
||||
// class MessageFormat
|
||||
|
|
@ -1077,7 +1078,7 @@ void MessageFormat::format(int32_t msgStart, const void *plNumber,
|
|||
// that formats the number without subtracting the offset.
|
||||
appendTo.formatAndAppend(pluralNumber.formatter, *arg, success);
|
||||
}
|
||||
} else if ((formatter = getCachedFormatter(i -2))) {
|
||||
} else if ((formatter = getCachedFormatter(i -2)) != 0) {
|
||||
// Handles all ArgType.SIMPLE, and formatters from setFormat() and its siblings.
|
||||
if (dynamic_cast<const ChoiceFormat*>(formatter) ||
|
||||
dynamic_cast<const PluralFormat*>(formatter) ||
|
||||
|
|
@ -1700,12 +1701,21 @@ Format* MessageFormat::createAppropriateFormat(UnicodeString& type, UnicodeStrin
|
|||
formattableType = Formattable::kLong;
|
||||
fmt = createIntegerFormat(fLocale, ec);
|
||||
break;
|
||||
default: // pattern
|
||||
fmt = NumberFormat::createInstance(fLocale, ec);
|
||||
if (fmt) {
|
||||
DecimalFormat* decfmt = dynamic_cast<DecimalFormat*>(fmt);
|
||||
if (decfmt != NULL) {
|
||||
decfmt->applyPattern(style,parseError,ec);
|
||||
default: // pattern or skeleton
|
||||
int32_t i = 0;
|
||||
for (; PatternProps::isWhiteSpace(style.charAt(i)); i++);
|
||||
if (style.compare(i, 2, u"::", 0, 2) == 0) {
|
||||
// Skeleton
|
||||
UnicodeString skeleton = style.tempSubString(i + 2);
|
||||
fmt = number::NumberFormatter::forSkeleton(skeleton, ec).locale(fLocale).toFormat(ec);
|
||||
} else {
|
||||
// Pattern
|
||||
fmt = NumberFormat::createInstance(fLocale, ec);
|
||||
if (fmt) {
|
||||
auto* decfmt = dynamic_cast<DecimalFormat*>(fmt);
|
||||
if (decfmt != nullptr) {
|
||||
decfmt->applyPattern(style, parseError, ec);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1954,16 +1964,19 @@ UnicodeString MessageFormat::PluralSelectorProvider::select(void *ctx, double nu
|
|||
context.formatter = msgFormat.getDefaultNumberFormat(ec);
|
||||
context.forReplaceNumber = TRUE;
|
||||
}
|
||||
U_ASSERT(context.number.getDouble(ec) == number); // argument number minus the offset
|
||||
if (context.number.getDouble(ec) != number) {
|
||||
ec = U_INTERNAL_PROGRAM_ERROR;
|
||||
return UnicodeString(FALSE, OTHER_STRING, 5);
|
||||
}
|
||||
context.formatter->format(context.number, context.numberString, ec);
|
||||
const DecimalFormat *decFmt = dynamic_cast<const DecimalFormat *>(context.formatter);
|
||||
auto* decFmt = dynamic_cast<const DecimalFormat *>(context.formatter);
|
||||
if(decFmt != NULL) {
|
||||
VisibleDigitsWithExponent digits;
|
||||
decFmt->initVisibleDigitsWithExponent(context.number, digits, ec);
|
||||
number::impl::DecimalQuantity dq;
|
||||
decFmt->formatToDecimalQuantity(context.number, dq, ec);
|
||||
if (U_FAILURE(ec)) {
|
||||
return UnicodeString(FALSE, OTHER_STRING, 5);
|
||||
}
|
||||
return rules->select(digits);
|
||||
return rules->select(dq);
|
||||
} else {
|
||||
return rules->select(number);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue