Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/125-language'
Browse files Browse the repository at this point in the history
To actually merge #137, which had `125-language` as base when merged
  • Loading branch information
fsteeg committed Dec 18, 2023
2 parents 6cd7ce2 + 9a0f2c0 commit ab4a752
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
37 changes: 37 additions & 0 deletions draft/examples/data-extension-response/valid/example-dir.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"meta": [
{
"id": "Len",
"name": "Label (for language code 'en')"
},
{
"id": "Afa",
"name": "Also known as (for language code 'fa')"
}
],
"rows": [
{
"id": "Q37093",
"dir": "ltr",
"properties": [
{
"id": "Len",
"values": [
{
"str": "Yahoo!"
}
]
},
{
"id": "Afa",
"values": [
{
"str": "یاهو!",
"dir": "rtl"
}
]
}
]
}
]
}
19 changes: 19 additions & 0 deletions draft/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,8 @@ <h3>Service Manifest</h3>
<dd>An <a>security scheme</a>, supplied if the service supports <a href="#authentication">authentication</a>.</dd>
<dt><code>lang</code></dt>
<dd>An optional value for the default <a href="#text-processing-language">text-processing language</a> used by this service.</dd>
<dt><code>dir</code></dt>
<dd>An optional value for the default <a href="#text-direction">text direction</a> used by this service.</dd>
</dl>
</p>
<p>For instance, a service could expose the following minimal service manifest:
Expand Down Expand Up @@ -941,6 +943,23 @@ <h3>Text-processing language</h3>
</p>

</section>
<section>
<h3>Text direction</h3>

<p>All objects returned by reconciliation services (entities, types, properties, candidates, features, etc.) MAY declare an explicit text <a href="https://www.w3.org/International/articles/inline-bidi-markup/uba-basics">
base direction</a> in a <code>dir</code> field. The <code>dir</code> value MUST be <code>ltr</code> for left-to-right, <code>rtl</code> for right-to-left, or <code>auto</code> for determining the direction by examining the content of each JSON field.
This base direction applies to the natural language fields of the object: <code>name</code> and <code>description</code> (for candidates etc.), <code>v</code> and <code>str</code> (for <a>property values</a>).
Nested objects inherit the base direction of their parent, and can override it by setting their own <code>dir</code> value. A default base direction for any natural language string returned or processed by a service MAY be set in the <code>dir</code> field of the
<a href="#service-manifest">service manifest</a>. If no explicit base direction is given, left-to-right is considered the default base direction. Clients SHOULD consider the base direction to ensure correct rendering of content, e.g. by setting corresponding <code>dir</code> attributes when rendering JSON responses in HTML.
For instance, rendering a Persian label for 'Yahoo!' like <code>یاهو!</code> right-to-left will correctly display as <code dir="rtl">یاهو!</code>.</p>

<p>In the following example, we first set the base direction for a data extension response row to <code>ltr</code>, which is inherited by the first property, and overridden in the second property with <code>rtl</code>:</p>

<p>
<pre data-include="examples/data-extension-response/valid/example-dir.json" class="example json"></pre>
</p>

</section>
</section>
<section>
<h2>Accessibility Considerations</h2>
Expand Down
6 changes: 6 additions & 0 deletions draft/schemas/data-extension-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
},
"lang": {
"type": "string"
},
"dir": {
"type": "string"
}
},
"required": [
Expand All @@ -98,6 +101,9 @@
},
"lang": {
"type": "string"
},
"dir": {
"type": "string"
}
},
"required": [
Expand Down

0 comments on commit ab4a752

Please sign in to comment.