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

EDITORIAL: Write CharacterDirectionOfLocale in more details #96

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
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.
FrankYFTang marked this conversation as resolved.
Show resolved Hide resolved
</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.
FrankYFTang marked this conversation as resolved.
Show resolved Hide resolved
</emu-note>
</emu-clause>

Expand Down
Loading