+
+ `*_localized` members
+
+
+ A localizable member is a [=manifest=] member that can be
+ localized. Each [=localizable member=] of the [=manifest=] has a
+ corresponding localized member with the suffix
+ `_localized`. For example, the [=manifest/name=] member is a
+ [=localizable member=], where `name_localized` is the corresponding
+ [=localized member=].
+
+
+ [=Localized members=] contain a [=localization map=] that defines
+ [=localized values=] for different locales denoted by a [=language
+ tag=]. If present and if the [=localization map=] contains a
+ [=localized value=] that matches the user's localization settings,
+ the user agent SHOULD override the value of the [=localizable
+ member=].
+
+
+
+ {
+ "lang": "en-US",
+ "name": "Color Picker",
+ "name_localized": {
+ "en-GB": "Colour Picker",
+ "fr": "Sélecteur de Couleur"
+ }
+ }
+
+
+
+ The localization map is an [=ordered map=] whose key is a
+ [=language tag=] and whose value is a [=localized value=]. The
+ localized value represents the value applied for the
+ [=language tag=] specified as the key. The value matches the type of
+ its corresponding [=localizable member=]. For example, a [=localized
+ value=] for the [=manifest/name=] member could directly be a
+ [=string=].
+
+
+ To support multilingual content and ensure proper display and
+ accessibility, it is possible to specify a different language tag and
+ text direction for a localized value. This is needed for situations
+ where a term or text must be presented in a language different from
+ the user's set language.
+
+
+ Alternatively, the [=localized value=] can be an [=ordered map=]
+ consisting of a `lang`, `dir`, and `value` member, where the `lang`
+ member is a [=language tag=], `dir` is a [=text-direction=], and
+ `value` contains the localization, matching the type of its
+ corresponding [=localizable member=]. The `lang` and `dir` members
+ are optional. When they are not set, `lang` matches the [=language
+ tag=] of the key, and `dir` matches the [=manifest/dir=] member of
+ the [=manifest=].
+
+
+
+
+ {
+ "lang": "en-US",
+ "dir": "ltr",
+ "shortcuts": [{
+ "description": "Change language",
+ "description_localized": {
+ "ar": { "lang": "en", "dir": "ltr", "value": "Change language" }
+ },
+ "icons": [{
+ "src": "/icons/play-later.svg",
+ "type": "image/svg+xml"
+ }],
+ "icons_localized": {
+ "ar": [{
+ "src": "/icons/ar/play-later.svg",
+ "type": "image/svg+xml"
+ }]
+ }
+ }]
+ }
+
+
+
+
+ To normalize the localized value , given |localizedValue|,
+ [=string=] |languageTag:string|, and [=ordered map=]
+ |manifest:ordered map|:
+
+
+ Let |normalizedValue| be an [=ordered map=].
+
+ If |localizedValue| is an [=ordered map=], and "value"
+ [=map/exists=] in |localizedValue|:
+
+ [=map/Set=] |normalizedValue|["value"] to
+ |localizedValue|["value"].
+
+ If "lang" [=map/exists=] in |localizedValue|, [=map/set=]
+ |normalizedValue|["lang"] to |localizedValue|["lang"].
+
+ If "dir" [=map/exists=] in |localizedValue|, [=map/set=]
+ |normalizedValue|["dir"] to |localizedValue|["dir"].
+
+
+
+ If "value" does not exist in |normalizedValue|, [=map/set=]
+ result["value"] to |localizedValue|.
+
+ If "lang" does not exist in |normalizedValue|, [=map/set=]
+ |result|["lang"] to |languageTag|.
+
+ If "dir" does not exist in |normalizedValue|, [=map/set=]
+ |normalizedValue|["dir"] to |manifest|["dir"].
+
+ Return |normalizedValue|.
+
+
+
+ To process a localizable member , given [=string=]
+ |localizableMemberName| and [=ordered map=] |json|:
+
+
+ Let |localizedMemberName| be the [=string/concatenation=] of the
+ [=list=] « |localizableMemberName|, "_localized" ».
+
+ If |localizedMemberName| [=map/exists=] in |json|:
+
+ Let |localizedMember| be |json|[|localizedMemberName|].
+
+ If |localizedMember| is not an [=ordered map=], continue.
+
+
+ Let |languageKey| be the most suitable language key based on
+ the user's localization settings from the [=map/keys=] of
+ |localizedMember|.
+
+ If |languageKey| has a value, return the result of
+ [=normalize the localized value=], passing
+ |localizedMember|[|languageKey|], |languageKey|, and |manifest|.
+
+
+
+ If |localizableMemberName| [=map/exists=] in |json|, return the
+ result of [=normalize the localized value=], passing
+ |json|[|localizableMemberName|], |manifest|["lang"], and |manifest|.
+
+ Otherwise, return.
+
+
+