Skip to content

Commit 0d864ff

Browse files
committed
Partially address #11. Add mention of JSON-LD including reference. Add text discussing string internationalization and language maps from JSON-LD 1.1, including links. Fix language tags in language map example.
1 parent 4df4bf5 commit 0d864ff

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

index.html

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -436,10 +436,10 @@ <h2>Current Best Practices for Tagging Language and Direction</h2>
436436

437437
<aside class=example>
438438
<pre>
439-
"title": [ en: { "value": "Moby Dick", "lang": "en" },
440-
ar: { "value": "موبي ديك", "lang": "ar" "dir": "rtl"},
441-
ja: { "value": "白鯨", "lang": "ja" },
442-
zh-Hans: { "value": "莫比迪克", "lang": "zh-Hans", "dir": "ltr"} ],
439+
"title": [ "en": { "value": "Moby Dick", "lang": "en" },
440+
"ar": { "value": "موبي ديك", "lang": "ar" "dir": "rtl"},
441+
"ja": { "value": "白鯨", "lang": "ja" },
442+
"zh-Hans": { "value": "莫比迪克", "lang": "zh-Hans", "dir": "ltr"} ],
443443
</pre>
444444
<p>Notice that this format embeds the <kbd>lang</kbd> field both as a key in the array and inside the enclosed <kbd>Localizable</kbd> so that the selected or preferred value can easily be extracted as a complete JavaScript or JSON object.</p>
445445
<p>For example, if the language selected is English (<kbd>en</kbd>), it is easy to extract the object <kbd>{ "value": "Moby Dick", "lang": "en" }</kbd> for inclusion into another data format.</p>
@@ -489,8 +489,8 @@ <h2>Current Best Practices for Tagging Language and Direction</h2>
489489
"lang": "en",
490490
"dir": "ltr",
491491
"id": {"978-0-1234-5678-X"},
492-
"title": [ en: {"value": "Moby Dick", "lang": "en"},
493-
ar: {"value": "موبي ديك", "lang": "ar" "dir": "rtl"} ],
492+
"title": [ "en": {"value": "Moby Dick", "lang": "en"},
493+
"ar": {"value": "موبي ديك", "lang": "ar" "dir": "rtl"} ],
494494
"authors": [ {"value": "Herman Melville", "lang": "en"} ],
495495
"language": "en-US",
496496
"pubDate": "1851-10-18",
@@ -645,7 +645,7 @@ <h2>Require HTML or XML for content</h2>
645645

646646

647647
<section id="langapproach2">
648-
<h2>Create a new datatype in JSON-LD</h2>
648+
<h2>Create a new datatype</h2>
649649
<p>If a new datatype were added to JSON to support natural language strings, then specifications could easily specify that type for use in document formats. Since the format is standardized, <a data-lt="producer">producers</a> and <a data-lt="consumer">consumers</a> would not need to guess about direction or language information when it is encoded. Such a serialization might look like the following:</p>
650650

651651
<pre class=example>
@@ -656,6 +656,10 @@ <h2>Create a new datatype in JSON-LD</h2>
656656
myLanguageNeutralString: "978-0-123-4567-X" // language-neutral string</pre>
657657

658658
<p>The downside of adding a datatype is that JSON is a widely implemented format, including many ad-hoc implementations. Any new serialization form would likely break or cause interoperability problems with these existing implementations. JSON is not designed to be a "versioned" format. Any serialization form used would need to be transparent to existing JSON processors and thus could introduce unwanted data or data corruption to existing fields and formats.</p>
659+
660+
<p>[[JSON-LD]] includes some data structures that are partially helpful. Notably, it defines <a href="https://json-ld.org/spec/latest/json-ld/#string-internationalization">string internationalization</a> in the form of a context-scoped <kbd>@language</kbd> value which can be associated with blocks of JSON or within individual objects. There is no definition of base direction, so this is incomplete. The <kbd>@context</kbd> concept can be used by specifications as a means of indicating the default language metadata where omitted from individual strings.</p>
661+
662+
<p>The concept of <a href="https://json-ld.org/spec/latest/json-ld/#language-indexing">language indexing</a> in JSON-LD is used in the Best Practices in this document as a means for localizing a data value.</p>
659663
</section>
660664

661665

0 commit comments

Comments
 (0)