Skip to content

Specs handling text direction

r12a edited this page Jul 29, 2016 · 25 revisions

Activity Streams

Notes

  • this is JSON
  • it's sent as single items
  • structured objects
  • only some strings are natural language
  • includes a mechanism for localised text
  • name property has no markup
  • summary and others do support HTML markup
  • an object can contains several natural language strings, which may have different base directions
  • either a summaryMap should become several objects, or FS will need to be used
  • the name property admits no markup, so control codes need to be used - otherwise, use markup for inline changes

Current solution proposed by Social WG:

for the name property (no markup allowed) add control codes at start and end of value for overall base direction and inline control codes for inline changes

Example 133

{
  "@context": {
    "@value": "http://www.w3.org/ns/activitystreams",
    "@language": "he"
  },
  "name": "\u202Bפעילות הבינאום, W3C\u202C",
  "type": "Note",
  "summary": "<span dir="rtl">פעילות הבינאום, W3C</span>"
}

for summary and content properties, use markup with dir attributes to establish overall base direction and inline changes

Example 134

{
  "@context": {
    "@value": "http://www.w3.org/ns/activitystreams",
    "@language": "he"
  },
  "name": "\u202Bפעילות הבינאום, W3C\u202C",
  "type": "Note",
  "summaryMap": {
    "he": "<span dir="rtl">פעילות הבינאום, W3C</span>",
    "en": "Internationalization Activity, W3C",
    "ar": "<span dir="rtl">نشاط التدويل، W3C</span>"
  }
}

Problems

  • can't expect users to add control characters or markup for default direction for every natural language string
  • users are expected to use different approaches for notes vs summary/content, which is confusing
  • all the usual problems with control codes (eg. difficult to use, may not be available on keyboard, even harder to edit, etc.)

Alternative suggestions

  • specify that the default is LTR
  • use one property per object to establish the base direction for RTL text
  • user only needs to revert to RLM/LRM only for exceptional text
  • if property value says auto, does FS analysis
  • setting a property is possibly more helpful when dealing with input from HTML forms, etc, where the direction information is carried separately from the text (dirname)
Example 133

{
  "@context": {
    "@value": "http://www.w3.org/ns/activitystreams",
    "@language": "he"
  },
  "direction": "rtl"
  "name": "פעילות הבינאום, W3C",
  "type": "Note",
  "summary": "פעילות הבינאום, W3C"
}
Example 134

{
  "@context": {
    "@value": "http://www.w3.org/ns/activitystreams",
    "@language": "he"
  },
  "direction": "rtl"
  "nameMap": {
    "he": "פעילות הבינאום, W3C",
    "en": "Internationalization Activity, W3C",
    "ar": "نشاط التدويل، W3C"
  }
  "type": "Note",
  "summaryMap": {
    "he": "פעילות הבינאום, W3C",
    "en": "Internationalization Activity, W3C",
    "ar": "نشاط التدويل، W3C"
  }
}