From 763394e75feca351c9018929ee1da60e19e37d02 Mon Sep 17 00:00:00 2001 From: Fabian Steeg Date: Wed, 13 Sep 2023 15:54:34 +0200 Subject: [PATCH 1/3] Add section on setting the text direction (#126) --- draft/index.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/draft/index.html b/draft/index.html index e0e3fea..8e4be3d 100644 --- a/draft/index.html +++ b/draft/index.html @@ -403,6 +403,8 @@

Service Manifest

The maximum number of reconciliation queries in a single reconciliation query batch. The service MAY respond to batches larger than this number with a 413 HTTP error status code [[RFC7231]]
authentication
An security scheme, supplied if the service supports authentication.
+
dir
+
An optional value for the default text direction used by this service.

For instance, a service could expose the following minimal service manifest: @@ -939,6 +941,18 @@

Text-processing language

If no explicit text-processing language is given, the first language of the intended audience returned by the service is considered the default text-processing language.

+
+

Text direction

+ +

All objects returned by reconciliation services (entities, types, properties, candidates, features, etc.) MAY declare an explicit text + base direction in a dir field. The dir value MUST be ltr for left-to-right, rtl for right-to-left, or auto for determining the direction by examining the content of each JSON field. + This base direction applies to the natural language fields of the object: name and description (for candidates etc.), v and str (for property values). + Nested objects inherit the base direction of their parent, and can override it by setting their own dir value. A default base direction for any natural language string returned by a service can be set in the dir field of the + service manifest. Clients SHOULD consider the base direction to ensure correct rendering of content, e.g. by setting corresponding dir attributes when rendering JSON responses in HTML. + For instance, rendering a Persian label for 'Yahoo!' like یاهو! right-to-left will correctly display as یاهو!.

+ +

If no explicit base direction is given, left-to-right is considered the default base direction.

+

Accessibility Considerations

From ea79f966657b68010d8f9b77983c05bcddee958a Mon Sep 17 00:00:00 2001 From: Fabian Steeg Date: Thu, 14 Sep 2023 16:49:09 +0200 Subject: [PATCH 2/3] Add example for base direction in data extension response (#126) --- .../valid/example-dir.json | 37 +++++++++++++++++++ draft/index.html | 6 +++ draft/schemas/data-extension-response.json | 6 +++ 3 files changed, 49 insertions(+) create mode 100644 draft/examples/data-extension-response/valid/example-dir.json diff --git a/draft/examples/data-extension-response/valid/example-dir.json b/draft/examples/data-extension-response/valid/example-dir.json new file mode 100644 index 0000000..628c0b2 --- /dev/null +++ b/draft/examples/data-extension-response/valid/example-dir.json @@ -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" + } + ] + } + ] + } + ] +} diff --git a/draft/index.html b/draft/index.html index 8e4be3d..6671357 100644 --- a/draft/index.html +++ b/draft/index.html @@ -951,6 +951,12 @@

Text direction

service manifest. Clients SHOULD consider the base direction to ensure correct rendering of content, e.g. by setting corresponding dir attributes when rendering JSON responses in HTML. For instance, rendering a Persian label for 'Yahoo!' like یاهو! right-to-left will correctly display as یاهو!.

+

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

+ +

+


+        

+

If no explicit base direction is given, left-to-right is considered the default base direction.

diff --git a/draft/schemas/data-extension-response.json b/draft/schemas/data-extension-response.json index e2715c4..22e9db7 100644 --- a/draft/schemas/data-extension-response.json +++ b/draft/schemas/data-extension-response.json @@ -82,6 +82,9 @@ }, "lang": { "type": "string" + }, + "dir": { + "type": "string" } }, "required": [ @@ -98,6 +101,9 @@ }, "lang": { "type": "string" + }, + "dir": { + "type": "string" } }, "required": [ From ad5f91bd390747907a2018ef19ffd96e876f8c3b Mon Sep 17 00:00:00 2001 From: Fabian Steeg Date: Tue, 12 Dec 2023 13:15:19 +0100 Subject: [PATCH 3/3] Minor tweaks in text direction for consistency on defaults (#137) --- draft/index.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/draft/index.html b/draft/index.html index d7174b8..ebe84f9 100644 --- a/draft/index.html +++ b/draft/index.html @@ -961,8 +961,8 @@

Text direction

All objects returned by reconciliation services (entities, types, properties, candidates, features, etc.) MAY declare an explicit text base direction in a dir field. The dir value MUST be ltr for left-to-right, rtl for right-to-left, or auto for determining the direction by examining the content of each JSON field. This base direction applies to the natural language fields of the object: name and description (for candidates etc.), v and str (for property values). - Nested objects inherit the base direction of their parent, and can override it by setting their own dir value. A default base direction for any natural language string returned by a service can be set in the dir field of the - service manifest. Clients SHOULD consider the base direction to ensure correct rendering of content, e.g. by setting corresponding dir attributes when rendering JSON responses in HTML. + Nested objects inherit the base direction of their parent, and can override it by setting their own dir value. A default base direction for any natural language string returned or processed by a service MAY be set in the dir field of the + service manifest. 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 dir attributes when rendering JSON responses in HTML. For instance, rendering a Persian label for 'Yahoo!' like یاهو! right-to-left will correctly display as یاهو!.

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

@@ -971,7 +971,6 @@

Text direction


         

-

If no explicit base direction is given, left-to-right is considered the default base direction.