Skip to content

Commit 210922c

Browse files
committed
spec: add TODOs for dotted
1 parent f394259 commit 210922c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,7 +1880,7 @@ <h1><span class="secnum">1.1.1</span> PartitionDurationFormatPattern ( <var>dura
18801880

18811881
<p>The PartitionDurationFormatPattern abstract operation is called with the arguments <var>durationFormat</var> (which must be an object initialized as a DurationFormat) and <var>duration</var> (which must be a <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">Record</a></emu-xref> with the fields enumerated in <emu-xref href="#table-duration-components" id="_ref_0"><a href="#table-duration-components">Table 1</a></emu-xref> ), and creates the corresponding parts according to the effective locale and the formatting options of <var>durationFormat</var>. The following steps are taken:</p>
18821882

1883-
<emu-alg><ol><li>Let <var>result</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>If <var>durationFormat</var>.[[Style]] is <code>"dotted"</code>, then<ol><li>Let <var>patternParts</var> be <emu-xref aoid="PartitionPattern"><a href="https://tc39.github.io/ecma402/#sec-partitionpattern">PartitionPattern</a></emu-xref>(<var>durationFormat</var>.[[Templates]]).</li><li>For each <var>patternPart</var> in <var>patternParts</var>, do<ol><li>Let <var>p</var> be <var>patternPart</var>.[[Type]].</li><li>If <var>p</var> is <code>"literal"</code>, then<ol><li>Append <var>patternPart</var> to the end of <var>result</var>.</li></ol></li><li>Else if <var>duration</var>[[&lt;<var>p</var>&gt;]] is not <emu-val>undefined</emu-val> and <var>p</var> exists in <var>durationFormat</var>.[[Fields]], then<ol><li>Let <var>num</var> be <emu-xref aoid="FormatNumeric"><a href="https://tc39.github.io/ecma402/#sec-formatnumber">FormatNumeric</a></emu-xref>(<var>durationFormat</var>.[[NumberFormat]], <var>duration</var>[[&lt;<var>p</var>&gt;]]).</li><li>Append the new <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">Record</a></emu-xref> { [[Type]]: <var>p</var>, [[Value]]: <var>num</var> } to the end of <var>result</var>.</li></ol></li></ol></li></ol></li><li>Else,<ol><li>For each row in <emu-xref href="#table-duration-components" id="_ref_1"><a href="#table-duration-components">Table 1</a></emu-xref> except the header row, do<ol><li>Let <var>field</var> be the Property value.</li><li>Let <var>val</var> be <var>duration</var>.[[&lt;<var>field</var>&gt;]]</li><li>If <var>val</var> is not <emu-val>undefined</emu-val> and <var>field</var> exists in <var>durationFormat</var>.[[Fields]], then<ol><li>Let <var>num</var> be !&nbsp;<emu-xref aoid="PartitionNumberPattern"><a href="https://tc39.github.io/ecma402/#sec-partitionnumberpattern">PartitionNumberPattern</a></emu-xref>(<var>durationFormat</var>.[[NumberFormat]], val).</li><li>Let <var>pr</var> be !&nbsp;<emu-xref aoid="ResolvePlural"><a href="https://tc39.github.io/ecma402/#sec-resolveplural">ResolvePlural</a></emu-xref>(<var>durationFormat</var>.[[PluralRules]], val).</li><li>Let <var>template</var> be <var>durationFormat</var>.[[Templates]].[[&lt;<var>field</var>&gt;]].[[&lt;<var>pr</var>&gt;]].</li><li>Let <var>parts</var> be !&nbsp;<emu-xref aoid="MakePartsList"><a href="https://tc39.github.io/ecma402/#sec-makepartslist">MakePartsList</a></emu-xref>(<var>template</var>, <var>field</var>, <var>num</var>).</li><li>Let <var>concat</var> be an empty String.</li><li>For each <var>part</var> in <var>parts</var>, do<ol><li>Set <var>concat</var> to the <emu-xref href="#sec-ecmascript-language-types-string-type"><a href="https://tc39.es/ecma262/#sec-ecmascript-language-types-string-type">string-concatenation</a></emu-xref> of <var>concat</var> and <var>part</var>.[[Value]].</li><li>If <var>part</var> has a [[Unit]] field, then<ol><li>Set <var>concat</var> to the <emu-xref href="#sec-ecmascript-language-types-string-type"><a href="https://tc39.es/ecma262/#sec-ecmascript-language-types-string-type">string-concatenation</a></emu-xref> of <var>concat</var> and <var>part</var>.[[Unit]].</li></ol></li></ol></li><li>Append the new <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">Record</a></emu-xref> { [[Type]]: <var>field</var>, [[Value]]: <var>concat</var> } to the end of <var>result</var>.</li></ol></li></ol></li><li>Set <var>result</var> to !&nbsp;<emu-xref aoid="CreatePartsFromList"><a href="https://tc39.github.io/proposal-intl-list-format/#sec-createpartsfromlist">CreatePartsFromList</a></emu-xref>(<var>durationFormat</var>.[[ListFormat]], <var>result</var>).</li></ol></li><li>Return <var>result</var>.
1883+
<emu-alg><ol><li>Let <var>result</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>If <var>durationFormat</var>.[[Style]] is <code>"dotted"</code>, then<ol><li><mark>TODO: [[Templates]] needs to be keyed by which fields are available in this case.</mark></li><li>Let <var>patternParts</var> be <emu-xref aoid="PartitionPattern"><a href="https://tc39.github.io/ecma402/#sec-partitionpattern">PartitionPattern</a></emu-xref>(<var>durationFormat</var>.[[Templates]]).</li><li>For each <var>patternPart</var> in <var>patternParts</var>, do<ol><li>Let <var>p</var> be <var>patternPart</var>.[[Type]].</li><li>If <var>p</var> is <code>"literal"</code>, then<ol><li>Append <var>patternPart</var> to the end of <var>result</var>.</li></ol></li><li>Else if <var>duration</var>[[&lt;<var>p</var>&gt;]] is not <emu-val>undefined</emu-val> and <var>p</var> exists in <var>durationFormat</var>.[[Fields]], then<ol><li>Let <var>num</var> be <emu-xref aoid="FormatNumeric"><a href="https://tc39.github.io/ecma402/#sec-formatnumber">FormatNumeric</a></emu-xref>(<var>durationFormat</var>.[[NumberFormat]], <var>duration</var>[[&lt;<var>p</var>&gt;]]).</li><li>Append the new <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">Record</a></emu-xref> { [[Type]]: <var>p</var>, [[Value]]: <var>num</var> } to the end of <var>result</var>.</li></ol></li></ol></li></ol></li><li>Else,<ol><li>For each row in <emu-xref href="#table-duration-components" id="_ref_1"><a href="#table-duration-components">Table 1</a></emu-xref> except the header row, do<ol><li>Let <var>field</var> be the Property value.</li><li>Let <var>val</var> be <var>duration</var>.[[&lt;<var>field</var>&gt;]]</li><li>If <var>val</var> is not <emu-val>undefined</emu-val> and <var>field</var> exists in <var>durationFormat</var>.[[Fields]], then<ol><li>Let <var>num</var> be !&nbsp;<emu-xref aoid="PartitionNumberPattern"><a href="https://tc39.github.io/ecma402/#sec-partitionnumberpattern">PartitionNumberPattern</a></emu-xref>(<var>durationFormat</var>.[[NumberFormat]], val).</li><li>Let <var>pr</var> be !&nbsp;<emu-xref aoid="ResolvePlural"><a href="https://tc39.github.io/ecma402/#sec-resolveplural">ResolvePlural</a></emu-xref>(<var>durationFormat</var>.[[PluralRules]], val).</li><li>Let <var>template</var> be <var>durationFormat</var>.[[Templates]].[[&lt;<var>field</var>&gt;]].[[&lt;<var>pr</var>&gt;]].</li><li>Let <var>parts</var> be !&nbsp;<emu-xref aoid="MakePartsList"><a href="https://tc39.github.io/ecma402/#sec-makepartslist">MakePartsList</a></emu-xref>(<var>template</var>, <var>field</var>, <var>num</var>).</li><li>Let <var>concat</var> be an empty String.</li><li>For each <var>part</var> in <var>parts</var>, do<ol><li>Set <var>concat</var> to the <emu-xref href="#sec-ecmascript-language-types-string-type"><a href="https://tc39.es/ecma262/#sec-ecmascript-language-types-string-type">string-concatenation</a></emu-xref> of <var>concat</var> and <var>part</var>.[[Value]].</li><li>If <var>part</var> has a [[Unit]] field, then<ol><li>Set <var>concat</var> to the <emu-xref href="#sec-ecmascript-language-types-string-type"><a href="https://tc39.es/ecma262/#sec-ecmascript-language-types-string-type">string-concatenation</a></emu-xref> of <var>concat</var> and <var>part</var>.[[Unit]].</li></ol></li></ol></li><li>Append the new <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">Record</a></emu-xref> { [[Type]]: <var>field</var>, [[Value]]: <var>concat</var> } to the end of <var>result</var>.</li></ol></li></ol></li><li>Set <var>result</var> to !&nbsp;<emu-xref aoid="CreatePartsFromList"><a href="https://tc39.github.io/proposal-intl-list-format/#sec-createpartsfromlist">CreatePartsFromList</a></emu-xref>(<var>durationFormat</var>.[[ListFormat]], <var>result</var>).</li></ol></li><li>Return <var>result</var>.
18841884
</li></ol></emu-alg>
18851885
</emu-clause>
18861886
</emu-clause>
@@ -1934,12 +1934,12 @@ <h1><span class="secnum">1.3.3</span> Internal slots</h1>
19341934
<p>The value of the [[LocaleData]] internal slot is implementation defined within the constraints described in <emu-xref href="#sec-internal-slots"><a href="https://tc39.github.io/ecma402/#sec-internal-slots">9.1</a></emu-xref> and the following additional constraints for all locale values <var>locale</var>:</p>
19351935

19361936
<ul>
1937-
19381937
<li>[[LocaleData]].[[&lt;<var>locale</var>&gt;]].[[nu]] must be a <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref> as specified in <emu-xref href="#sec-intl.numberformat-internal-slots"><a href="https://tc39.github.io/ecma402/#sec-intl.numberformat-internal-slots">12.3.3</a></emu-xref>.</li>
19391938
<li>[[LocaleData]].[[&lt;<var>locale</var>&gt;]] must have a [[formats]] field. The value of this field must be a record, which must have fields with the names of the four formatting styles: <code>long</code>, <code>short</code>, <code>narrow</code>, and <code>dotted</code>. Each of first three fields must be records themselves, and each must have fields with the names of the supported units: <code>nanonseconds</code>, <code>microseconds</code>, <code>milliseconds</code>, <code>seconds</code>, <code>minutes</code>, <code>hours</code>, <code>days</code>, <code>weeks</code>, <code>months</code>, and <code>years</code>, which are Records with a field for each of the plural categories relevant for <var>locale</var>; the value corresponding to those fields is a pattern which may contain "{0}" to be replaced by a formatted number. The value of the fourth field, corresponding to the <code>dotted</code> style, on the other hand, should be a pattern; i.e. a String that contains for an arbitrary subset of the Duration component fields a substring starting with <code>"{"</code>, followed by the name of the field, followed by <code>"}"</code>.</li>
19401939
</ul>
19411940

1942-
<emu-note type="editor"><span class="note">Editor's Note</span><div class="note-contents">It is recommended that implementations use the locale data provided by the Common Locale Data Repository (available at <a href="http://cldr.unicode.org/">http://cldr.unicode.org/</a>).</div></emu-note>
1941+
<emu-note type="editor"><span class="note">Editor's Note</span><div class="note-contents">TODO: [[formats]].[[dotted]] need to be keyed by the available fields.</div></emu-note>
1942+
<emu-note><span class="note">Note</span><div class="note-contents">It is recommended that implementations use the locale data provided by the Common Locale Data Repository (available at <a href="http://cldr.unicode.org/">http://cldr.unicode.org/</a>).</div></emu-note>
19431943
</emu-clause>
19441944
</emu-clause>
19451945

@@ -2036,6 +2036,7 @@ <h1><span class="secnum">1.5</span> Properties of Intl.DurationFormat Instances<
20362036
<li>[[PluralRules]] is an Intl.PluralRules object used for formatting.</li>
20372037
<li>[[ListFormat]] is an Intl.ListFormat object used for formatting.</li>
20382038
</ul>
2039+
<emu-note type="editor"><span class="note">Editor's Note</span><div class="note-contents">[[Templates]] needs to be keyed by the available fields when [[Style]] is "dotted"</div></emu-note>
20392040
</emu-clause>
20402041
</emu-clause><emu-annex id="sec-copyright-and-software-license">
20412042
<h1><span class="secnum">A</span> Copyright &amp; Software License</h1>

spec.emu

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ contributors: Ujjwal Sharma, Younies Mahmoud
7676
<emu-alg>
7777
1. Let _result_ be a new empty List.
7878
1. If _durationFormat_.[[Style]] is `"dotted"`, then
79+
1. <mark>TODO: [[Templates]] needs to be keyed by which fields are available in this case.</mark>
7980
1. Let _patternParts_ be PartitionPattern(_durationFormat_.[[Templates]]).
8081
1. For each _patternPart_ in _patternParts_, do
8182
1. Let _p_ be _patternPart_.[[Type]].
@@ -201,12 +202,12 @@ contributors: Ujjwal Sharma, Younies Mahmoud
201202
<p>The value of the [[LocaleData]] internal slot is implementation defined within the constraints described in <emu-xref href="#sec-internal-slots"></emu-xref> and the following additional constraints for all locale values _locale_:</p>
202203

203204
<ul>
204-
205205
<li>[[LocaleData]].[[<_locale_>]].[[nu]] must be a List as specified in <emu-xref href="#sec-intl.numberformat-internal-slots"></emu-xref>.</li>
206206
<li>[[LocaleData]].[[<_locale_>]] must have a [[formats]] field. The value of this field must be a record, which must have fields with the names of the four formatting styles: `long`, `short`, `narrow`, and `dotted`. Each of first three fields must be records themselves, and each must have fields with the names of the supported units: `nanonseconds`, `microseconds`, `milliseconds`, `seconds`, `minutes`, `hours`, `days`, `weeks`, `months`, and `years`, which are Records with a field for each of the plural categories relevant for _locale_; the value corresponding to those fields is a pattern which may contain "{0}" to be replaced by a formatted number. The value of the fourth field, corresponding to the `dotted` style, on the other hand, should be a pattern; i.e. a String that contains for an arbitrary subset of the Duration component fields a substring starting with `"{"`, followed by the name of the field, followed by `"}"`.</li>
207207
</ul>
208208

209-
<emu-note type=editor>It is recommended that implementations use the locale data provided by the Common Locale Data Repository (available at <a href="http://cldr.unicode.org/">http://cldr.unicode.org/</a>).</emu-note>
209+
<emu-note type=editor>TODO: [[formats]].[[dotted]] need to be keyed by the available fields.</emu-note>
210+
<emu-note>It is recommended that implementations use the locale data provided by the Common Locale Data Repository (available at <a href="http://cldr.unicode.org/">http://cldr.unicode.org/</a>).</emu-note>
210211
</emu-clause>
211212
</emu-clause>
212213

@@ -333,5 +334,6 @@ contributors: Ujjwal Sharma, Younies Mahmoud
333334
<li>[[PluralRules]] is an Intl.PluralRules object used for formatting.</li>
334335
<li>[[ListFormat]] is an Intl.ListFormat object used for formatting.</li>
335336
</ul>
337+
<emu-note type=editor>[[Templates]] needs to be keyed by the available fields when [[Style]] is "dotted"</emu-note>
336338
</emu-clause>
337339
</emu-clause>

0 commit comments

Comments
 (0)