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

Include input & option descriptions as data in registry #533

Merged
merged 5 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions spec/registry.dtd
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<!ELEMENT registry (function|validationRule)*>
<!ATTLIST registry
xml:lang NMTOKEN #IMPLIED
>
Comment on lines +2 to +4
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added xml:lang as an optional attribute on the top-level <registry>, as well as directly on <input> and <option>, to indicate the language of the included descriptions.

Should this be required, though? Or are there use cases where a <registry> could be e.g. embedded in another XML document, where the locale is defined somewhere further up the tree?

Copy link
Member

Choose a reason for hiding this comment

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

We should do this differently. Literally in the next tab of the browser I have a PR open on string-meta with best practices. See also this article.

I think we'd be best off here by putting the natural language string descriptions into sub-elements description which are allowed to vary by xml:lang. Setting xml:lang="en" at the registry element level would allow us to have <description> without xml:lang attributes throughout.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done. Many <desciption> now.


<!ELEMENT function (description,(formatSignature|matchSignature)+)>
<!ATTLIST function
Expand All @@ -24,21 +27,23 @@
locales NMTOKENS #IMPLIED
>

<!ELEMENT input EMPTY>
<!ELEMENT input (#PCDATA)>
<!ATTLIST input
values NMTOKENS #IMPLIED
validationRule IDREF #IMPLIED
readonly (true|false) "false"
xml:lang NMTOKEN #IMPLIED
>

<!ELEMENT option EMPTY>
<!ELEMENT option (#PCDATA)>
<!ATTLIST option
name NMTOKEN #REQUIRED
values NMTOKENS #IMPLIED
default NMTOKEN #IMPLIED
validationRule IDREF #IMPLIED
required (true|false) "false"
readonly (true|false) "false"
xml:lang NMTOKEN #IMPLIED
>

<!ELEMENT match EMPTY>
Expand Down
207 changes: 117 additions & 90 deletions spec/registry.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="registry.dtd" type="application/xml-dtd"?>
<registry>
<registry xml:lang="en">
<!-- All regex here are to be seen as provisory. See issue #422. -->
<validationRule id="anyNumber" regex="-?(0|([1-9]\d*))(\.\d*)?([eE][-+]?\d+)?"/>
<validationRule id="positiveInteger" regex="0|([1-9]\d*)"/>
Expand All @@ -15,21 +15,25 @@

<formatSignature>
<input validationRule="iso8601"/>
<!-- The predefined date formatting style to use. -->
<option name="dateStyle" values="full long medium short"/>
<!-- The predefined time formatting style to use. -->
<option name="timeStyle" values="full long medium short"/>
<!-- Calendar to use. -->
<option name="calendar" values="buddhist chinese coptic dangi ethioaa ethiopic gregory hebrew indian islamic islamic-umalqura islamic-tbla islamic-civil islamic-rgsa iso8601 japanese persian roc"/>
<!-- Numbering system to use. -->
<option name="numberingSystem" values="arab arabext bali beng deva fullwide gujr guru hanidec khmr knda laoo latn limb mlym mong mymr orya tamldec telu thai tibt"/>
<!-- The time zone to use. The only value implementations must recognize
is "UTC"; the default is the runtime's default time zone.
Implementations may also recognize the time zone names of the IANA
time zone database, such as "Asia/Shanghai", "Asia/Kolkata",
"America/New_York".
-->
<option name="timeZone" validationRule="timeZoneId"/>
<option name="dateStyle" values="full long medium short">
The predefined date formatting style to use.
</option>
<option name="timeStyle" values="full long medium short">
The predefined time formatting style to use.
</option>
<option name="calendar" values="buddhist chinese coptic dangi ethioaa ethiopic gregory hebrew indian islamic islamic-umalqura islamic-tbla islamic-civil islamic-rgsa iso8601 japanese persian roc">
Copy link
Member

Choose a reason for hiding this comment

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

Which source did you use for these? We should have a pointer as this list is not likely to be stabilized.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I only moved the description into the body here; the values were added by @mihnita in #420; I presume that their source is the ECMA-402 spec, which may itself refer to another source.

Copy link
Member

Choose a reason for hiding this comment

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

I know. But once they move from comments to data, we should spend some extra effort on it 😉

Calendar to use.
</option>
<option name="numberingSystem" values="arab arabext bali beng deva fullwide gujr guru hanidec khmr knda laoo latn limb mlym mong mymr orya tamldec telu thai tibt">
Copy link
Member

Choose a reason for hiding this comment

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

This list is incomplete? Can we point to CLDR data here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Again, I didn't change the values, only moved the description from the comment to the the contents.

Copy link
Member

Choose a reason for hiding this comment

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

ibid

Numbering system to use.
</option>
<option name="timeZone" validationRule="timeZoneId">
The time zone to use.
The only value implementations must recognize is "UTC";
the default is the runtime's default time zone.
Implementations may also recognize the time zone names of the IANA time zone database,
such as "Asia/Shanghai", "Asia/Kolkata", "America/New_York".
</option>
</formatSignature>

<!-- TODO: clarify if this is OK or if it is an abuse.
Expand All @@ -38,41 +42,56 @@
-->
<formatSignature>
<input validationRule="iso8601"/>
<!-- Calendar to use. -->
<option name="calendar" values="buddhist chinese coptic dangi ethioaa ethiopic gregory hebrew indian islamic islamic-umalqura islamic-tbla islamic-civil islamic-rgsa iso8601 japanese persian roc"/>
<!-- The formatting style used for day periods like "in the morning", "am", "noon", "n" etc. -->
<option name="dayPeriod" values="narrow short long"/>
<!-- Numbering system to use. -->
<option name="numberingSystem" values="arab arabext bali beng deva fullwide gujr guru hanidec khmr knda laoo latn limb mlym mong mymr orya tamldec telu thai tibt"/>
<!-- The time zone to use. The only value implementations must recognize
is "UTC"; the default is the runtime's default time zone.
Implementations may also recognize the time zone names of the IANA time zone
database, such as "Asia/Shanghai", "Asia/Kolkata", "America/New_York".
-->
<option name="timeZone" validationRule="timeZoneId"/>
<!-- The hour cycle to use. -->
<option name="hourCycle" values="h11 h12 h23 h24"/>
<!-- The representation of the weekday. -->
<option name="weekday" values="long short narrow"/>
<!-- The representation of the era. -->
<option name="era" values="long short narrow"/>
<!-- The representation of the year. -->
<option name="year" values="numeric 2-digit"/>
<!-- The representation of the month. -->
<option name="month" values="numeric 2-digit long short narrow"/>
<!-- The representation of the day. -->
<option name="day" values="numeric 2-digit"/>
<!-- The representation of the hour. -->
<option name="hour" values="numeric 2-digit"/>
<!-- The representation of the minute. -->
<option name="minute" values="numeric 2-digit"/>
<!-- The representation of the second. -->
<option name="second" values="numeric 2-digit"/>
<!-- The number of digits used to represent fractions of a second
(any additional digits are truncated). -->
<option name="fractionalSecondDigits" values="1 2 3"/>
<!-- The localized representation of the time zone name. -->
<option name="timeZoneName" values="long short shortOffset longOffset shortGeneric longGeneric"/>
<option name="calendar" values="buddhist chinese coptic dangi ethioaa ethiopic gregory hebrew indian islamic islamic-umalqura islamic-tbla islamic-civil islamic-rgsa iso8601 japanese persian roc">
Calendar to use.
</option>
<option name="dayPeriod" values="narrow short long">
The formatting style used for day periods like "in the morning", "am", "noon", "n" etc.
</option>
<option name="numberingSystem" values="arab arabext bali beng deva fullwide gujr guru hanidec khmr knda laoo latn limb mlym mong mymr orya tamldec telu thai tibt">
Numbering system to use.
</option>
<option name="timeZone" validationRule="timeZoneId">
The time zone to use.
The only value implementations must recognize is "UTC";
the default is the runtime's default time zone.
Implementations may also recognize the time zone names of the IANA time zone database,
such as "Asia/Shanghai", "Asia/Kolkata", "America/New_York".
</option>
<option name="hourCycle" values="h11 h12 h23 h24">
The hour cycle to use.
</option>
<option name="weekday" values="long short narrow">
The representation of the weekday.
</option>
<option name="era" values="long short narrow">
The representation of the era.
</option>
<option name="year" values="numeric 2-digit">
The representation of the year.
</option>
<option name="month" values="numeric 2-digit long short narrow">
The representation of the month.
</option>
<option name="day" values="numeric 2-digit">
The representation of the day.
</option>
<option name="hour" values="numeric 2-digit">
The representation of the hour.
</option>
<option name="minute" values="numeric 2-digit">
The representation of the minute.
</option>
<option name="second" values="numeric 2-digit">
The representation of the second.
</option>
<option name="fractionalSecondDigits" values="1 2 3">
The number of digits used to represent fractions of a second
(any additional digits are truncated).
</option>
<option name="timeZoneName" values="long short shortOffset longOffset shortGeneric longGeneric">
The localized representation of the time zone name.
</option>
</formatSignature>

</function>
Expand All @@ -83,63 +102,71 @@

<formatSignature>
<input validationRule="anyNumber"/>
<!-- Only used when notation is "compact". -->
<option name="compactDisplay" values="short long" default="short"/>
<!-- The currency to use in currency formatting.
<option name="compactDisplay" values="short long" default="short">
Only used when notation is "compact".
</option>
<option name="currency" validationRule="currencyCode">
The currency to use in currency formatting.
Possible values are the ISO 4217 currency codes, such as "USD" for the US dollar,
"EUR" for the euro, or "CNY" for the Chinese RMB — see the
Current currency & funds code list
(https://www.six-group.com/en/products-services/financial-information/data-standards.html#scrollTo=currency-codes).
Current currency &amp; funds code list
(https://www.unicode.org/cldr/charts/latest/supplemental/detailed_territory_currency_information.html).
There is no default value; if the style is "currency", the currency property must be provided.
-->
<option name="currency" validationRule="currencyCode"/>
<!-- How to display the currency in currency formatting. -->
<option name="currencyDisplay" values="symbol narrowSymbol code name" default="symbol"/>
<!-- In many locales, accounting format means to wrap the number with parentheses
</option>
<option name="currencyDisplay" values="symbol narrowSymbol code name" default="symbol">
How to display the currency in currency formatting.
</option>
<option name="currencySign" values="accounting standard" default="standard">
In many locales, accounting format means to wrap the number with parentheses
instead of appending a minus sign. You can enable this formatting by setting the
currencySign option to "accounting".
-->
<option name="currencySign" values="accounting standard" default="standard"/>
<!-- The formatting that should be displayed for the number. -->
<option name="notation" values="standard scientific engineering compact" default="standard"/>
<!-- Numbering system to use. -->
<option name="numberingSystem" values="arab arabext bali beng deva fullwide gujr guru hanidec khmr knda laoo latn limb mlym mong mymr orya tamldec telu thai tibt"/>
<!-- When to display the sign for the number. -->
<!-- "negative" value is Experimental. -->
<option name="signDisplay" values="auto always exceptZero never" default="auto"/>
<!-- The formatting style to use. -->
<option name="style" values="decimal currency percent unit" default="decimal"/>
<!-- The unit to use in unit formatting.
</option>
<option name="notation" values="standard scientific engineering compact" default="standard">
The formatting that should be displayed for the number.
</option>
<option name="numberingSystem" values="arab arabext bali beng deva fullwide gujr guru hanidec khmr knda laoo latn limb mlym mong mymr orya tamldec telu thai tibt">
Numbering system to use.
</option>
<option name="signDisplay" values="auto always exceptZero never" default="auto">
When to display the sign for the number. "negative" value is Experimental.
</option>
<option name="style" values="decimal currency percent unit" default="decimal">
The formatting style to use.
</option>
<option name="unit" validationRule="anythingNotEmpty">
The unit to use in unit formatting.
Possible values are core unit identifiers, defined in UTS #35, Part 2, Section 6.
A subset of units from the full list was selected for use in ECMAScript.
Pairs of simple units can be concatenated with "-per-" to make a compound unit.
There is no default value; if the style is "unit", the unit property must be provided.
-->
<option name="unit" validationRule="anythingNotEmpty"/>
<!-- The unit formatting style to use in unit formatting. -->
<option name="unitDisplay" values="long short narrow" default="short"/>
<!-- The minimum number of integer digits to use.
</option>
<option name="unitDisplay" values="long short narrow" default="short">
The unit formatting style to use in unit formatting.
</option>
<option name="minimumIntegerDigits" values="positiveInteger" default="1">
The minimum number of integer digits to use.
A value with a smaller number of integer digits than this number will be
left-padded with zeros (to the specified length) when formatted.
-->
<option name="minimumIntegerDigits" values="positiveInteger" default="1"/>
<!-- The minimum number of fraction digits to use.
</option>
<option name="minimumFractionDigits" values="positiveInteger">
The minimum number of fraction digits to use.
The default for plain number and percent formatting is 0;
the default for currency formatting is the number of minor unit digits provided by
the ISO 4217 currency code list (2 if the list doesn't provide that information).
-->
<option name="minimumFractionDigits" values="positiveInteger"/>
<!-- The maximum number of fraction digits to use.
</option>
<option name="maximumFractionDigits" values="positiveInteger">
The maximum number of fraction digits to use.
The default for plain number formatting is the larger of minimumFractionDigits and 3;
the default for currency formatting is the larger of minimumFractionDigits and the number of minor
unit digits provided by the ISO 4217 currency code list (2 if the list doesn't provide that information);
the default for percent formatting is the larger of minimumFractionDigits and 0.
-->
<option name="maximumFractionDigits" values="positiveInteger"/>
<!-- The minimum number of significant digits to use. -->
<option name="minimumSignificantDigits" values="positiveInteger" default="1"/>
<!-- The maximum number of significant digits to use. -->
<option name="maximumSignificantDigits" values="positiveInteger" default="21"/>
</option>
<option name="minimumSignificantDigits" values="positiveInteger" default="1">
The minimum number of significant digits to use.
</option>
<option name="maximumSignificantDigits" values="positiveInteger" default="21">
The maximum number of significant digits to use.
</option>
</formatSignature>

</function>
Expand Down