HTML5 Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/6971

SVNBugCommentTime (UTC)
697112417[Authors] [Conformance Checkers] [Tools] Introduce a new global attribute for localisers to tell whether or not content should be translated.2012-02-07 00:22
Index: source
===================================================================
--- source	(revision 6970)
+++ source	(revision 6971)
@@ -11199,6 +11199,7 @@
   // <span>metadata attributes</span>
            attribute DOMString <span title="dom-title">title</span>;
            attribute DOMString <span title="dom-lang">lang</span>;
+           attribute boolean <span title="dom-translate">translate</span>;
            attribute DOMString <span title="dom-dir">dir</span>;
            attribute <span>DOMString</span> <span title="dom-className">className</span>;
   readonly attribute <span>DOMTokenList</span> <span title="dom-classList">classList</span>;
@@ -11341,6 +11342,7 @@
    <li><code title="attr-style">style</code></li>
    <li><code title="attr-tabindex">tabindex</code></li>
    <li><code title="attr-title">title</code></li>
+   <li><code title="attr-translate">translate</code></li>
   </ul>
 
   <div class="impl">
@@ -11718,6 +11720,84 @@
 
 
 
+  <h5>The <code title="attr-translate">translate</code> attribute</h5>
+
+  <p>The <dfn title="attr-translate"><code>translate</code></dfn>
+  attribute is an <span>enumerated attribute</span> that is used to
+  specify whether an element's attribute values and the values of its
+  <code>Text</code> node children are to be translated when the page
+  is localized, or whether to leave them unchanged.</p>
+
+  <p>The attribute's keywords are the empty string, <code
+  title="">yes</code>, and <code title="">no</code>. The empty string
+  and the <code title="">yes</code> keyword map to the <i>yes</i>
+  state. The <code title="">no</code> keyword maps to the <i>no</i>
+  state. In addition, there is a third state, the <i>inherit</i>
+  state, which is the <i>missing value default</i> (and the <i>invalid
+  value default</i>).</p>
+
+  <p>Each element has a <dfn>translation mode</dfn>, which is in
+  either the <span>translate-enabled</span> state or the
+  <span>no-translate</span> state. If the element's <code
+  title="attr-translate">translate</code> attribute is in the
+  <i>yes</i> state, then the element's <span>translation mode</span>
+  is in the <span>translate-enabled</span> state. Otherwise, if the
+  element's <code title="attr-translate">translate</code> attribute is
+  in the <i>no</i> state, then the element's <span>translation
+  mode</span> is in the <span>no-translate</span> state. Otherwise,
+  the element's code title="attr-translate">translate</code> attribute
+  is in the <i>inherit</i> state; in that case, the element's
+  <span>translation mode</span> is in the same state as its parent
+  element, if any, or in the <span>translate-enabled</span> state, if
+  the element is a <span>root element</span>.</p>
+
+  <p>When an element is in the <dfn>translate-enabled</dfn> state, the
+  element's attribute values and the values of its <code>Text</code>
+  node children are to be translated when the page is localized.</p>
+
+  <p>When an element is in the <dfn>no-translate</dfn> state, the
+  element's attribute values and the values of its <code>Text</code>
+  node children are to be left as-is when the page is localized, e.g.
+  because the element contains a person's name or a the name of a
+  computer program.</p>
+
+  <div class="impl">
+
+  <hr>
+
+  <p>The <dfn title="dom-translate"><code>translate</code></dfn> IDL
+  attribute must, on getting, return true if the element's
+  <span>translation mode</span> is <span>translate-enabled</span>, and
+  false otherwise. On setting, it must set the content attribute's
+  value to "<code title="">yes</code>" if the new value is true, and
+  set the content attribute's value to "<code title="">no</code>
+  otherwise.</p>
+
+  </div>
+
+  <div class="example">
+
+   <p>In this example, everything in the document is to be translated
+   when the page is localised, except the sample keyboard input and
+   sample program output:</p>
+
+   <pre>&lt;!DOCTYPE HTML>
+&lt;html> &lt;!-- default on the root element is translate=yes -->
+ &lt;head>
+  &lt;title>The Bee Game&lt;/title> &lt;!-- implied translate=yes inherited from ancestors -->
+ &lt;/head>
+ &lt;body>
+  &lt;p>The Bee Game is a text adventure game in English.&lt;/p>
+  &lt;p>When the game launches, the first thing you should do is type
+  &lt;kbd <strong>translate=no</strong>>eat honey&lt;/kbd>. The game will respond with:&lt;/p>
+  &lt;pre>&lt;samp <strong>translate=no</strong>>Yum yum! That was some good honey!&lt;/samp>&lt;/pre>
+ &lt;/body>
+&lt;/html></pre>
+
+  </div>
+
+
+
   <h5>The <dfn title="attr-xml-base"><code>xml:base</code></dfn>
   attribute (XML only)</h5>
 
@@ -112847,6 +112927,11 @@
      <td> Alternative style sheet set name
      <td> <a href="#attribute-text">Text</a>
     <tr>
+     <th> <code title="">translate</code>
+     <td> <span title="attr-translate">HTML elements</span>
+     <td> Whether the element is to be translated when the page is localized
+     <td> "<code title="">yes</code>"; "<code title="">no</code>"
+    <tr>
      <th> <code title="">type</code>
      <td> <code title="attr-hyperlink-type">a</code>;
           <code title="attr-hyperlink-type">area</code>;

|