mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 15:27:32 +09:00
Issue #1969 - Implement Intl.RelativeTimeFormat.
Based on Mozilla bugs 1270140, 1504656, 1483545, and 1504334. Took note of Mozilla bug 1379222 which changed GetPrototypeFromCallableConstructor to GetPrototypeFromBuiltinConstructor. There are many other changes I did myself since the initial implementation by Mozilla wouldn't work with this codebase.
This commit is contained in:
parent
c090dd7ce8
commit
3e6cbc6af3
13 changed files with 669 additions and 20 deletions
|
|
@ -162,14 +162,20 @@ const UnicodeString& RelativeDateTimeCacheData::getAbsoluteUnitString(
|
|||
URelativeDateTimeUnit unit,
|
||||
int32_t pastFutureIndex,
|
||||
int32_t pluralUnit) const {
|
||||
int32_t style = fStyle;
|
||||
do {
|
||||
if (relativeUnitsFormatters[style][unit][pastFutureIndex][pluralUnit] != nullptr) {
|
||||
return relativeUnitsFormatters[style][unit][pastFutureIndex][pluralUnit];
|
||||
while (true) {
|
||||
int32_t style = fStyle;
|
||||
do {
|
||||
if (relativeUnitsFormatters[style][unit][pastFutureIndex][pluralUnit] != nullptr) {
|
||||
return relativeUnitsFormatters[style][unit][pastFutureIndex][pluralUnit];
|
||||
}
|
||||
style = fallBackCache[style];
|
||||
} while (style != -1);
|
||||
|
||||
if (pluralUnit == StandardPlural::OTHER) {
|
||||
return nullptr; // No formatter found.
|
||||
}
|
||||
style = fallBackCache[style];
|
||||
} while (style != -1);
|
||||
return nullptr; // No formatter found.
|
||||
pluralUnit = StandardPlural::OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
static UBool getStringWithFallback(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue