Skip to content

Commit

Permalink
Trim string values in localized text objects
Browse files Browse the repository at this point in the history
  • Loading branch information
christianliebel committed Sep 27, 2024
1 parent 1629fd0 commit 072a8c1
Showing 1 changed file with 31 additions and 19 deletions.
50 changes: 31 additions & 19 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1401,8 +1401,8 @@ <h3>
</li>
<li>[=Set/For each=] |languageTag:string| of |languageTags|, run
[=process a localized text object=], passing
|languageMap|[|languageTag|] as the [=localized value=],
|languageTag|, |map|, |member|, and |defaultDirection|.
|languageMap|[|languageTag|], |languageTag|, |map|, |member|, and
|defaultDirection|.
</li>
</ol>
<p>
Expand All @@ -1415,33 +1415,45 @@ <h3>
<ol class="algorithm">
<li>Let |normalizedValue:ordered map| be an [=ordered map=].
</li>
<li>If |localizedValue| is a [=string=], [=map/set=]
|normalizedValue|["value"] to |localizedValue:string|.
<li>If |localizedValue| is a [=string=], [=strip leading and
trailing ASCII whitespace=] from |localizedValue:string| and
[=map/set=] |normalizedValue|["value"] to |localizedValue|.
</li>
<li>If |localizedValue:ordered map| is an [=ordered map=]:
<ol>
<li>If "value" [=map/exists=] in |localizedValue|, [=map/set=]
|normalizedValue|["value"] to |localizedValue|["value"].
<li>If "value" [=map/exists=] in |localizedValue| and
|localizedValue|["value"] is a [=string=], [=strip leading and
trailing ASCII whitespace=] from |localizedValue|["value"] and
[=map/set=] |normalizedValue|["value"] to
|localizedValue|["value"].
</li>
<li>If "lang" [=map/exists=] in |localizedValue|, [=map/set=]
|normalizedValue|["lang"] to |localizedValue|["lang"].
<li>If "lang" [=map/exists=] in |localizedValue| and
|localizedValue|["lang"] is a [=string=], [=strip leading and
trailing ASCII whitespace=] from |localizedValue|["lang"] and
[=map/set=] |normalizedValue|["lang"] to
|localizedValue|["lang"].
</li>
<li>If "dir" [=map/exists=] in |localizedValue|, [=map/set=]
|normalizedValue|["dir"] to |localizedValue|["dir"].
<li>If "dir" [=map/exists=] in |localizedValue| and
|localizedValue|["dir"] is a [=string=]:
<ol>
<li>[=Strip leading and trailing ASCII whitespace=] from
|localizedValue|["dir"].
</li>
<li>If [=text-direction list=] [=list/contains=]
|localizedValue|["dir"], [=map/set=]
|normalizedValue|["dir"] to |localizedValue|["dir"].
</li>
</ol>
</li>
</ol>
</li>
<li>If "value" does not [=map/exist=] in |normalizedValue|, or
|normalizedValue|["value"] is not a [=string=], return.
<li>If "value" does not [=map/exist=] in |normalizedValue|, return.
</li>
<li>If "lang" does not [=map/exist=] in |normalizedValue|, or
|normalizedValue|["lang"] is not a [=string=], [=map/set=]
|normalizedValue|["lang"] to |defaultLanguageTag|.
<li>If "lang" does not [=map/exist=] in |normalizedValue|,
[=map/set=] |normalizedValue|["lang"] to |defaultLanguageTag|.
</li>
<li>If "dir" does not [=map/exist=] in |normalizedValue|, or
[=text-direction list=] does not [=list/contain=]
|normalizedValue|["dir"], [=map/set=] |normalizedValue|["dir"] to
|defaultDirection|.
<li>If "dir" does not [=map/exist=] in |normalizedValue|,
[=map/set=] |normalizedValue|["dir"] to |defaultDirection|.
</li>
<li>If calling <a data-cite=
"ECMA-402#sec-isstructurallyvalidlanguagetag">IsStructurallyValidLanguageTag</a>
Expand Down

0 comments on commit 072a8c1

Please sign in to comment.