Skip to content

Commit

Permalink
EDITORIAL Write CharacterDirectionOfLocale in more details
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
FrankYFTang committed Dec 18, 2024
1 parent 6459bc4 commit cd8f154
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3345,9 +3345,9 @@ <h1><span class="secnum">1.1.6</span> TimeZonesOfLocale ( <var>loc</var> )</h1>
<emu-clause id="sec-character-direction-of-locale" type="abstract operation" aoid="CharacterDirectionOfLocale">
<h1><span class="secnum">1.1.7</span> CharacterDirectionOfLocale ( <var>loc</var> )</h1>
<p>The abstract operation CharacterDirectionOfLocale takes argument <var>loc</var> (an Intl.Locale) and returns <emu-val>"ltr"</emu-val> or <emu-val>"rtl"</emu-val>. The following algorithm refers to Locale data specified in <a href="https://www.unicode.org/reports/tr35/tr35-general.html#Layout_Elements" data-print-href="">UTS 35's Layouts Elements</a>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>locale</var> be <var>loc</var>.<var class="field">[[Locale]]</var>.</li><li>If the default general ordering of characters (characterOrder) within a line in <var>locale</var> is right-to-left, return <emu-val>"rtl"</emu-val>.</li><li>Return <emu-val>"ltr"</emu-val>.</li></ol></emu-alg>
<emu-alg><ol><li>Let <var>locale</var> be <var>loc</var>.<var class="field">[[Locale]]</var>.</li><li>Let <var>script</var> be <emu-xref aoid="GetLocaleScript"><a href="https://tc39.es/ecma402/#sec-getlocalescript">GetLocaleScript</a></emu-xref>(<var>locale</var>).</li><li>If <var>script</var> is <emu-val>undefined</emu-val>, then<ol><li>Let <var>maximal</var> be the result of the <a href="https://unicode.org/reports/tr35/#Likely_Subtags" data-print-href="">Add Likely Subtags</a> algorithm applied to <var>locale</var>. If an error is signaled, return <emu-val>"ltr"</emu-val>.</li><li>Set <var>script</var> to <emu-xref aoid="GetLocaleScript"><a href="https://tc39.es/ecma402/#sec-getlocalescript">GetLocaleScript</a></emu-xref>(<var>maximal</var>).</li><li>If <var>script</var> is <emu-val>undefined</emu-val>, return <emu-val>"ltr"</emu-val>.</li></ol></li><li>If the default general ordering of characters within a line in <var>script</var> is right-to-left, return <emu-val>"rtl"</emu-val>.</li><li>Return <emu-val>"ltr"</emu-val>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
When the direction of default general ordering of characters (characterOrder) within a line in the locale cannot be determined, or is not right-to-left, <emu-val>"ltr"</emu-val> will be retruned.
When the direction of default general ordering of characters within a line in the <var>script</var> cannot be determined, or is not right-to-left, <emu-val>"ltr"</emu-val> will be retruned.
</div></emu-note>
</emu-clause>
Expand Down
9 changes: 7 additions & 2 deletions locale.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,16 @@ <h1>
</dl>
<emu-alg>
1. Let _locale_ be _loc_.[[Locale]].
1. If the default general ordering of characters (characterOrder) within a line in _locale_ is right-to-left, return *"rtl"*.
1. Let _script_ be GetLocaleScript(_locale_).
1. If _script_ is *undefined*, then
1. Let _maximal_ be the result of the <a href="https://unicode.org/reports/tr35/#Likely_Subtags">Add Likely Subtags</a> algorithm applied to _locale_. If an error is signaled, return *"ltr"*.
1. Set _script_ to GetLocaleScript(_maximal_).
1. If _script_ is *undefined*, return *"ltr"*.
1. If the default general ordering of characters within a line in _script_ is right-to-left, return *"rtl"*.
1. Return *"ltr"*.
</emu-alg>
<emu-note>
When the direction of default general ordering of characters (characterOrder) within a line in the locale cannot be determined, or is not right-to-left, *"ltr"* will be retruned.
When the direction of default general ordering of characters within a line in the _script_ cannot be determined, or is not right-to-left, *"ltr"* will be retruned.
</emu-note>
</emu-clause>

Expand Down

0 comments on commit cd8f154

Please sign in to comment.