From cd8f154e85244bc1d7c40bc15bf208809dccff31 Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Wed, 18 Dec 2024 12:51:36 -0800 Subject: [PATCH] EDITORIAL Write CharacterDirectionOfLocale in more details fix --- index.html | 4 ++-- locale.html | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 9f64055..917d546 100644 --- a/index.html +++ b/index.html @@ -3345,9 +3345,9 @@

1.1.6 TimeZonesOfLocale ( loc )

1.1.7 CharacterDirectionOfLocale ( loc )

The abstract operation CharacterDirectionOfLocale takes argument loc (an Intl.Locale) and returns "ltr" or "rtl". The following algorithm refers to Locale data specified in UTS 35's Layouts Elements. It performs the following steps when called:

-
  1. Let locale be loc.[[Locale]].
  2. If the default general ordering of characters (characterOrder) within a line in locale is right-to-left, return "rtl".
  3. Return "ltr".
+
  1. Let locale be loc.[[Locale]].
  2. Let script be GetLocaleScript(locale).
  3. If script is undefined, then
    1. Let maximal be the result of the Add Likely Subtags algorithm applied to locale. If an error is signaled, return "ltr".
    2. Set script to GetLocaleScript(maximal).
    3. If script is undefined, return "ltr".
  4. If the default general ordering of characters within a line in script is right-to-left, return "rtl".
  5. Return "ltr".
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.
diff --git a/locale.html b/locale.html index cd2db96..2dd38c7 100644 --- a/locale.html +++ b/locale.html @@ -113,11 +113,16 @@

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 Add Likely Subtags 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"*. - 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.