Notification.lang and Notification.dir support in Web Notifications implementations

The Web Notifications WG is poised to take the Web Notifications spec at
http://www.w3.org/TR/notifications to Rec soon, and there are two
i18n-related points with regard to current implementations that it’s
appropriate to give the I18N Core WG a heads-up on at this time.

Here are details about the two points

1. Step 4 at http://www.w3.org/TR/notifications/#dom-notification states UA
   requirement with regard to the value of the Notification.lang property,
   whose purpose is to convey the language of a notification. That step
   reads, “If options’s lang is a valid BCP 47 language tag, or the empty
   string, set notification’s language to options’s lang, or set it to the
   empty string otherwise.”

   Restated, if a Web application tries to set a “lang” value that is not a
   valid BCP 47 language tag, then according to the spec, the UA should set
   the actual “lang” property to the empty string.

   Try the following test in Firefox and Chrome and Safari (the only UAs
   the currently implement the spec).

   http://w3c-test.org/notifications/notification-lang.html

   What you’ll find is that if you use a valid BCP 47 language tag, the UAs
   behave as you would expect, and set the notification’s language value to
   the BCP 47 language tag you indicated.

   However, if you use a string that is an *invalid* BCP 47 language tag,
   no UA follows the spec requirement to set the notification’s language
   value to the empty string.

   Instead it’s all just basically “garbage in, garbage out”: If you use
   the string “Latn-de”, the UAs will set the notification’s lang value to
   exactly that—without checking whether it’s a valid BCP 47 value.

   So this isn’t really a problem in the normal case, since if Web
   developers have their Web applications use valid BCP 47 language tags to
   begin with, everything will work as expected. (And if they set a value
   that’s not a valid BCP 47 language tag, things aren’t going to work
   as expected for end users—regardless of what UAs do with it.)

   So it would seem to be sufficient to address the state of the UA
   implementations on this point just by adding a non-normative note to the
   space saying that UAs currently don’t check whether the “lang” value is
   a valid BCP 47 language tag, and don’t set the “lang” value to the empty
   string if they’re given an invalid BCP 47 language tag to process.

2. The “Direction” section http://www.w3.org/TR/notifications/#direction-0
   of the spec has a somewhat soft requirement that the platform-level
   widgets that actually display the text of notifications should display
   that text in a right-to-left direction if a notification’s “dir”
   property is set to indicate that.

   Try the following test in Firefox and Chrome and Safari (the only UAs
   the currently implement the spec).

   http://w3c-test.org/notifications/notification-dir-rtl-manual.html

   What I believe you’ll find is that on no platforms where you test it
   is the text rendered in a right-to-left direction. (Or depending on how
   you have your environment set up, you may actually find otherwise, I
   dunno. But at least in my testing, I couldn’t get the text of any
   notification on any platform to display in a right-to-left direction.)

   All that said, it’s not clear to me that the UAs aren’t in conformance
   with this spec on this, because the only language in the spec that comes
   anywhere close to stating a hard requirement here is the statement,
   “User agents are expected to honor the Unicode semantics of the text of
   a notification’s title and body.”, which is of course not clearly using
   RFC 2119 language for stating an actual requirement, and even if it did
   state it using a “must” it would still not be clearly stating anything
   exactly and specifically that UAs must do.

   Part of the reason for that is, the nature of the notifications defined
   by this spec is that they are so-called “desktop notifications” which
   aren’t displayed within a Web document or even within a browser window
   but are instead displayed outside the browser, as platform-level
   notifications, in the same way that notifications from other
   applications running on the platform are displayed.

   So especially depending on the particular platform a UA is running on,
   the UA may not have much control at all over the details of how the
   notification is displayed. That makes this behavior somewhat of a UI
   issue, and we normally try to have specs not define UI requirements, so
   that limits what the spec can say (and try to enforce) in this case.

   So it would seem to be sufficient to address the state of the UA
   implementations on this point just by adding a non-normative note to the
   space telling Web developers that the current state of platforms which
   display Web notifications is such that they can’t expect the text of
   notifications to be displayed right-to-left on every platform.

     —Mike

-- 
Michael[tm] Smith https://people.w3.org/mike

Received on Tuesday, 7 July 2015 11:53:21 UTC