Skip to content

Editorial: Identify the sanctioned units as a subset of CLDR#610

Closed
gibson042 wants to merge 7 commits intotc39:masterfrom
gibson042:gh-564-unit-identifiers
Closed

Editorial: Identify the sanctioned units as a subset of CLDR#610
gibson042 wants to merge 7 commits intotc39:masterfrom
gibson042:gh-564-unit-identifiers

Conversation

@gibson042
Copy link
Member

…and correctly use UTS 35 terms.

Fixes #564


<p>
The IsSanctionedSimpleUnitIdentifier abstract operation verifies that the given core unit identifier is among the simple units sanctioned in the current version of the ECMAScript Internationalization API Specification, a subset of the Validity Data as described in <a href="https://unicode.org/reports/tr35/tr35.html#Validity_Data">UTS #35, Part 1, Section 3.11</a>; the list may grow over time. As discussed in UTS #35, a simple unit is one that does not have a numerator and denominator. The following steps are taken:
The IsSanctionedSimpleUnitIdentifier abstract operation verifies that the _unitIdentifier_ argument (which must be a String value) is among the single unit identifiers sanctioned in the current version of the ECMAScript Internationalization API Specification, which are a subset of the Common Locale Data Repository <a href="https://github.com/unicode-org/cldr/blob/maint/maint-38/common/validity/unit.xml">release 38 unit validity data</a>; the list may grow over time. As discussed in UTS #35, a single unit identifier is a core unit identifier that is not composed of multiplication or division of other unit identifiers. The following steps are taken:
Copy link
Member Author

Choose a reason for hiding this comment

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

This text contains the only use of "current version of the ECMAScript Internationalization API Specification" that I could find (everywhere else uses "this specification" or "ECMAScript 2022 Internationalization API Specification"). A followup should reconcile that, ideally matching ECMA-262 (which seems to prefer "this specification").


<emu-table id="table-sanctioned-simple-unit-identifiers">
<emu-caption>Simple units sanctioned for use in ECMAScript</emu-caption>
<emu-caption>Single units sanctioned for use in ECMAScript</emu-caption>
Copy link
Member Author

Choose a reason for hiding this comment

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

As described in UTS #35, prefixed unit identifiers such as "centimeter" and "gigabit" are not simple. I've updated the text, but I'm thinking I should also rename the algorithm and replace the table id. Thoughts, @tc39/ecma402-editors?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, the terms "single" and "simple" were hammered down in UTS 35 and now ECMA-402 has bitrot. I think we should use the new UTS 35 terminology ("single" rather than "simple").

1. Return *true*.
1. If the substring *"-per-"* does not occur exactly once in _unitIdentifier_, then
1. Let _i_ be ! StringIndexOf(_unitIdentifier_, *"-per-"*, 0).
1. If _i_ is -1 or ! StringIndexOf(_unitIdentifier_, *"-per-"*, _i_ + 1) is not -1, then
Copy link
Member Author

Choose a reason for hiding this comment

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

These editorial algorithm changes are gratuitous, but they do fit in with the rest of the PR.

@gibson042 gibson042 requested review from ryzokuken and sffc January 6, 2022 00:44

<emu-table id="table-sanctioned-simple-unit-identifiers">
<emu-caption>Simple units sanctioned for use in ECMAScript</emu-caption>
<emu-caption>Single units sanctioned for use in ECMAScript</emu-caption>
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, the terms "single" and "simple" were hammered down in UTS 35 and now ECMA-402 has bitrot. I think we should use the new UTS 35 terminology ("single" rather than "simple").

@gibson042
Copy link
Member Author

Thanks @sffc , I have updated accordingly.

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.

Accept plural forms of unit in Intl.NumberFormat

2 participants