W3C home > Mailing lists > Public > public-svg-wg@w3.org > October to December 2012

svg2: Add 'lang' attribute to desc and title elements.

From: SVG Working Group repository <cam@mcc.id.au>
Date: Thu, 25 Oct 2012 12:59:14 -0700
Message-Id: <hg.59e3920357cb.1351195154.3034738116371802840@ps58493.dreamhostps.com>
To: public-svg-wg@w3.org
details:   https://svgwg.org/hg/svg2/rev/59e3920357cb
branches:  
changeset: 397:59e3920357cb
user:      tbah <tavmjong@free.fr>
date:      Thu Oct 25 21:57:58 2012 +0200
description:
Add 'lang' attribute to desc and title elements.

diffstat:

 master/definitions.xml |   5 ++++
 master/struct.html     |  61 ++++++++++++++++++-------------------------------
 2 files changed, 28 insertions(+), 38 deletions(-)

diffs (187 lines):

diff --git a/master/definitions.xml b/master/definitions.xml
--- a/master/definitions.xml
+++ b/master/definitions.xml
@@ -162,16 +162,17 @@
     attributecategories='conditional processing, core, graphical event, presentation, style'
     interfaces='SVGDefsElement'/>
 
   <element
     name='desc'
     href='struct.html#DescElement'
     contentmodel='any'
     attributecategories='core, style'
+    attributes='lang'
     interfaces='SVGDescElement'/>
 
   <element
     name='discard'
     href='struct.html#DiscardElement'
     contentmodel='anyof'
     elementcategories='descriptive'
     attributecategories='conditional processing, core'
@@ -700,16 +701,17 @@
     <attribute name='spacing' href='text.html#TextPathElementSpacingAttribute' animatable='yes'/>
   </element>
 
   <element
     name='title'
     href='struct.html#TitleElement'
     contentmodel='any'
     attributecategories='core, style'
+    attributes='lang'
     interfaces='SVGTitleElement'/>
 
   <element
       name='tref'
       href='text.html#TRefElement'
       contentmodel='anyof'
       elementcategories='descriptive'
       elements='animate, animateColor, set'
@@ -780,16 +782,19 @@
   <!-- ... attributes common to multiple elements ........................ -->
 
   <!-- Note: An <attribute> defined here applies only to the listed
        elements if a list is given in 'elements', otherwise, it
        applies to all <element>s that include the attribute name in
        their 'attribute' attribute.
   -->
 
+  <!-- attributes common to both desc and title -->
+  <attribute name='lang' elements='desc, title' href='fonts.html#GlyphElementLangAttribute'/>
+
   <!-- attributes common to both glyph and missing-glyph -->
   <attribute name='d' elements='glyph, missing-glyph' href='fonts.html#GlyphElementDAttribute'/>
   <attribute name='horiz-adv-x' elements='glyph, missing-glyph' href='fonts.html#GlyphElementHorizAdvXAttribute'/>
   <attribute name='vert-origin-x' elements='glyph, missing-glyph' href='fonts.html#GlyphElementVertOriginXAttribute'/>
   <attribute name='vert-origin-y' elements='glyph, missing-glyph' href='fonts.html#GlyphElementVertOriginYAttribute'/>
   <attribute name='vert-adv-y' elements='glyph, missing-glyph' href='fonts.html#GlyphElementVertAdvYAttribute'/>
 
   <!-- attributes common to hkern and vkern -->
diff --git a/master/struct.html b/master/struct.html
--- a/master/struct.html
+++ b/master/struct.html
@@ -918,59 +918,67 @@ and <span class='element-name'>'title'</
 <div id='DescElement'>
 <edit:elementsummary name='desc'/>
 </div>
 
 <div id='TitleElement'>
 <edit:elementsummary name='title'/>
 </div>
 
+<p class="note">The attribute <a>'lang'</a> added to allow internationalization
+of the <a>'desc'</a> and <a>'title element'</a> elements.</p>
+
+<p class="annotation">Adding 'lang' resolved at Rigi Kaltbad face-to-face.
+Removed text that limited number of 'desc' and 'title' elements.</p>
+
 <p class="issue">Is there any updated wording from SVG Tiny 1.2 that we
 should be using wrt tooltips?</p>
 
 <p>Each <a>container element</a> or <a>graphics element</a> in an SVG drawing
-can supply a <a>'desc'</a> and/or a <a>'title'</a> description string where
+can supply one or more <a>'desc'</a> and/or one or more <a>'title'</a> description 
+strings where
 the description is text-only. When the current SVG document fragment is
 rendered as SVG on visual media, <a>'desc'</a> and <a>'title'</a> elements are
 not rendered as part of the graphics. User agents may, however, for example,
 display the <a>'title'</a> element as a tooltip, as the pointing device moves
 over particular elements. Alternate presentations are possible, both visual and
 aural, which display the <a>'desc'</a> and <a>'title'</a> elements but do not
 display <a>'path'</a> elements or other <a>graphics elements</a>.  This is
 readily achieved by using a different (perhaps user) style sheet. For deep
 hierarchies, and for following <a>'use'</a> element references, it is
 sometimes desirable to allow the user to control how deep they drill down into
 descriptive text.</p>
 
 <p class="issue">I don't think it is easy to use a style sheet to cause
 an element's <a>'title'</a> to be rendered in place of its graphics.</p>
 
-<p>In conforming SVG document fragments, any <a>'title'</a> element should be
-the first child element of its parent.  Note that those implementations that do
-use <a>'title'</a> to display a tooltip often will only do so if the
-<a>'title'</a> is indeed the first child element of its parent.</p>
-
-<p class="issue">Is it a SHOULD or a MUST that the <a>'title'</a> is the first
-element child?  We should check if the statement about implementations looking
-at the first child for a tooltip is still accurate.</p>
+<p>More than one <a>'desc'</a> or <a>'title element'</a> may be
+present with different <a>'lang'</a> attributes. The text displayed
+will be the text from the element where the <a>'lang'</a> attribute
+best matches the language set by the user agent. If no match exists,
+the text from the first element is used (to allow default text to be
+given for legacy renderers). If multiple equally valid matches exist,
+the first match is used.</p>
+
+<p class="issue">'lang' should be defined here (rather than pointing to
+the glyph definition).</p>
 
 <p>The following is an example. In typical operation, the SVG user agent would
 not render the <a>'desc'</a> and <a>'title'</a> elements but would render the
 remaining contents of the <a>'g'</a> element.</p>
 
 <pre><![CDATA[
 <?xml version="1.0" standalone="no"?>
 <svg xmlns="http://www.w3.org/2000/svg"
      version="1.1" width="4in" height="3in">
   <g>
     <title>Company sales by region</title>
-    <desc>
-      This is a bar chart which shows 
-      company sales by region.
-    </desc>
+    <title lang="fr">Chiffre d'affaires par région</title>
+    <desc>Bar chart which shows company sales by region.</desc>
+    <desc lang="fr">Graphique illustrant les ventes par région.</desc>
     <!-- Bar chart defined as vector data -->
   </g>
 </svg>
 ]]></pre>
 
 <p>Description and title elements can contain marked-up text
 from other namespaces. Here is an example:</p>
 
@@ -1003,41 +1011,18 @@ authors should provide context-rich titl
 title such as "Introduction", which doesn't provide much
 contextual background, authors should supply a title such as
 "Introduction to Medieval Bee-Keeping" instead. For reasons of
 accessibility, user agents should always make the content of
 the <a>'title'</a> child element to the <a>outermost svg element</a>
 available to users. The mechanism for doing so depends on the user agent
 (e.g., as a caption, spoken).</p>
 
-<p>The definitions of many of SVG's elements (particularly,
-container and text elements) place no restriction on the
-placement or number of the <a>'desc'</a> and <a>'title'</a> sub-elements.
-This flexibility is only present so that there will be a consistent
-content model for container elements, because some container
-elements in SVG allow for mixed content, and because
-<a href="http://www.w3.org/TR/2008/REC-xml-20081126/#sec-mixed-content">the mixed content rules for XML</a>
-([<a href="refs.html#ref-XML10">XML10</a>], section 3.2.2)
-do not permit the desired restrictions. Future
-versions of the SVG language might have more restrictive
-mixed content rules. It is strongly recommended that at most
-one <a>'desc'</a> and at most one <a>'title'</a> element appear as a
-child of any particular element, and that these elements appear
-before any other child elements (except possibly
-<a>'metadata'</a> elements) or character data content. If user agents need to
-choose among multiple <a>'desc'</a> or <a>'title'</a> elements for processing
-(e.g., to decide which string to use for a tooltip), the user
-agent shall choose the first one.</p>
-
-<p class="issue">We are no longer using DTDs.  Are we happy to have
-a prose restriction for conforming SVG documents to have at most one
-<a>'title'</a> and <a>'desc'</a> child, and their positions?</p>
-
-<p class="issue">We have this sentence here about tooltips using the
-first element, which is stronger than the earlier note that some
+<p class="issue">We have this sentence here about tooltips
+which is stronger than the earlier note that some
 implementations do this.  We should look at how HTML describes
 the <span class="attr-name">'title'</span> attribute and whether
 a tooltip is required, suggested, etc., and follow that.</p>
 
 <p class="issue">Once we have said how ARIA attributes can be used
 in SVG, we might want to define <a>'title'</a> and <a>'desc'</a>
 in a manner consistent with them, so that it is clear what it means
 for example for an element to have both a <a>'desc'</a> element
Received on Thursday, 25 October 2012 20:00:33 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:20:16 UTC