Navigation Menu

Skip to content

Commit

Permalink
[act] (0) Introduce a new global attribute for localisers to tell whe…
Browse files Browse the repository at this point in the history
…ther or not content should be translated.

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=12417
Affected topics: DOM APIs, HTML

git-svn-id: http://svn.whatwg.org/webapps@6971 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Feb 7, 2012
1 parent 9b56f41 commit 864baf4
Show file tree
Hide file tree
Showing 3 changed files with 269 additions and 22 deletions.
103 changes: 92 additions & 11 deletions complete.html
Expand Up @@ -240,7 +240,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 6 February 2012</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 7 February 2012</h2>
</hgroup><dl><dt><strong>Web developer edition:</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
Expand Down Expand Up @@ -397,12 +397,13 @@ <h2 class="no-num no-toc">Living Standard &mdash; Last Updated 6 February 2012</
<li><a href=#the-id-attribute><span class=secno>3.2.3.1 </span>The <code>id</code> attribute</a></li>
<li><a href=#the-title-attribute><span class=secno>3.2.3.2 </span>The <code>title</code> attribute</a></li>
<li><a href=#the-lang-and-xml:lang-attributes><span class=secno>3.2.3.3 </span>The <code title=attr-lang>lang</code> and <code title=attr-xml-lang>xml:lang</code> attributes</a></li>
<li><a href=#the-xml:base-attribute-(xml-only)><span class=secno>3.2.3.4 </span>The <code>xml:base</code>
<li><a href=#the-translate-attribute><span class=secno>3.2.3.4 </span>The <code title=attr-translate>translate</code> attribute</a></li>
<li><a href=#the-xml:base-attribute-(xml-only)><span class=secno>3.2.3.5 </span>The <code>xml:base</code>
attribute (XML only)</a></li>
<li><a href=#the-dir-attribute><span class=secno>3.2.3.5 </span>The <code>dir</code> attribute</a></li>
<li><a href=#classes><span class=secno>3.2.3.6 </span>The <code>class</code> attribute</a></li>
<li><a href=#the-style-attribute><span class=secno>3.2.3.7 </span>The <code>style</code> attribute</a></li>
<li><a href=#embedding-custom-non-visible-data-with-the-data-*-attributes><span class=secno>3.2.3.8 </span>Embedding custom non-visible data with the <code title=attr-data-*>data-*</code> attributes</a></ol></li>
<li><a href=#the-dir-attribute><span class=secno>3.2.3.6 </span>The <code>dir</code> attribute</a></li>
<li><a href=#classes><span class=secno>3.2.3.7 </span>The <code>class</code> attribute</a></li>
<li><a href=#the-style-attribute><span class=secno>3.2.3.8 </span>The <code>style</code> attribute</a></li>
<li><a href=#embedding-custom-non-visible-data-with-the-data-*-attributes><span class=secno>3.2.3.9 </span>Embedding custom non-visible data with the <code title=attr-data-*>data-*</code> attributes</a></ol></li>
<li><a href=#element-definitions><span class=secno>3.2.4 </span>Element definitions</a>
<ol>
<li><a href=#attributes><span class=secno>3.2.4.1 </span>Attributes</a></ol></li>
Expand Down Expand Up @@ -10833,6 +10834,7 @@ <h4 id=elements-in-the-dom><span class=secno>3.2.2 </span>Elements in the DOM</h
// <span>metadata attributes</span>
attribute DOMString <a href=#dom-title title=dom-title>title</a>;
attribute DOMString <a href=#dom-lang title=dom-lang>lang</a>;
attribute boolean <a href=#dom-translate title=dom-translate>translate</a>;
attribute DOMString <a href=#dom-dir title=dom-dir>dir</a>;
attribute <span>DOMString</span> <a href=#dom-classname title=dom-className>className</a>;
readonly attribute <a href=#domtokenlist>DOMTokenList</a> <a href=#dom-classlist title=dom-classList>classList</a>;
Expand Down Expand Up @@ -10974,6 +10976,7 @@ <h4 id=global-attributes><span class=secno>3.2.3 </span><dfn>Global attributes</
<li><code title=attr-style><a href=#the-style-attribute>style</a></code></li>
<li><code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code></li>
<li><code title=attr-title><a href=#the-title-attribute>title</a></code></li>
<li><code title=attr-translate><a href=#attr-translate>translate</a></code></li>
</ul><div class=impl>

<p>These attributes are only defined by this specification as
Expand Down Expand Up @@ -11303,7 +11306,81 @@ <h5 id=the-lang-and-xml:lang-attributes><span class=secno>3.2.3.3 </span>The <co



<h5 id=the-xml:base-attribute-(xml-only)><span class=secno>3.2.3.4 </span>The <dfn title=attr-xml-base><code>xml:base</code></dfn>
<h5 id=the-translate-attribute><span class=secno>3.2.3.4 </span>The <code title=attr-translate><a href=#attr-translate>translate</a></code> attribute</h5>

<p>The <dfn id=attr-translate title=attr-translate><code>translate</code></dfn>
attribute is an <a href=#enumerated-attribute>enumerated attribute</a> that is used to
specify whether an element's attribute values and the values of its
<code><a href=#text>Text</a></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 id=translation-mode>translation mode</dfn>, which is in
either the <a href=#translate-enabled>translate-enabled</a> state or the
<a href=#no-translate>no-translate</a> state. If the element's <code title=attr-translate><a href=#attr-translate>translate</a></code> attribute is in the
<i>yes</i> state, then the element's <a href=#translation-mode>translation mode</a>
is in the <a href=#translate-enabled>translate-enabled</a> state. Otherwise, if the
element's <code title=attr-translate><a href=#attr-translate>translate</a></code> attribute is
in the <i>no</i> state, then the element's <a href=#translation-mode>translation
mode</a> is in the <a href=#no-translate>no-translate</a> state. Otherwise,
the element's code title="attr-translate"&gt;translate attribute
is in the <i>inherit</i> state; in that case, the element's
<a href=#translation-mode>translation mode</a> is in the same state as its parent
element, if any, or in the <a href=#translate-enabled>translate-enabled</a> state, if
the element is a <a href=#root-element>root element</a>.</p>

<p>When an element is in the <dfn id=translate-enabled>translate-enabled</dfn> state, the
element's attribute values and the values of its <code><a href=#text>Text</a></code>
node children are to be translated when the page is localized.</p>

<p>When an element is in the <dfn id=no-translate>no-translate</dfn> state, the
element's attribute values and the values of its <code><a href=#text>Text</a></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 id=dom-translate title=dom-translate><code>translate</code></dfn> IDL
attribute must, on getting, return true if the element's
<a href=#translation-mode>translation mode</a> is <a href=#translate-enabled>translate-enabled</a>, 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&gt;
&lt;html&gt; &lt;!-- default on the root element is translate=yes --&gt;
&lt;head&gt;
&lt;title&gt;The Bee Game&lt;/title&gt; &lt;!-- implied translate=yes inherited from ancestors --&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;The Bee Game is a text adventure game in English.&lt;/p&gt;
&lt;p&gt;When the game launches, the first thing you should do is type
&lt;kbd <strong>translate=no</strong>&gt;eat honey&lt;/kbd&gt;. The game will respond with:&lt;/p&gt;
&lt;pre&gt;&lt;samp <strong>translate=no</strong>&gt;Yum yum! That was some good honey!&lt;/samp&gt;&lt;/pre&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>

</div>



<h5 id=the-xml:base-attribute-(xml-only)><span class=secno>3.2.3.5 </span>The <dfn title=attr-xml-base><code>xml:base</code></dfn>
attribute (XML only)</h5>

<p>The <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attribute is
Expand All @@ -11315,7 +11392,7 @@ <h5 id=the-xml:base-attribute-(xml-only)><span class=secno>3.2.3.4 </span>The <d
<a href=#html-documents>HTML documents</a>.</p>


<h5 id=the-dir-attribute><span class=secno>3.2.3.5 </span>The <dfn title=attr-dir><code>dir</code></dfn> attribute</h5>
<h5 id=the-dir-attribute><span class=secno>3.2.3.6 </span>The <dfn title=attr-dir><code>dir</code></dfn> attribute</h5>

<p>The <code title=attr-dir><a href=#the-dir-attribute>dir</a></code> attribute specifies the
element's text directionality. The attribute is an <a href=#enumerated-attribute>enumerated
Expand Down Expand Up @@ -11529,7 +11606,7 @@ <h5 id=the-dir-attribute><span class=secno>3.2.3.5 </span>The <dfn title=attr-di



<h5 id=classes><span class=secno>3.2.3.6 </span>The <dfn title=attr-class><code>class</code></dfn> attribute</h5>
<h5 id=classes><span class=secno>3.2.3.7 </span>The <dfn title=attr-class><code>class</code></dfn> attribute</h5>

<p>Every <a href=#html-elements title="HTML elements">HTML element</a> may have a
<code title=attr-class><a href=#classes>class</a></code> attribute specified.</p>
Expand Down Expand Up @@ -11568,7 +11645,7 @@ <h5 id=classes><span class=secno>3.2.3.6 </span>The <dfn title=attr-class><code>



<h5 id=the-style-attribute><span class=secno>3.2.3.7 </span>The <dfn title=attr-style><code>style</code></dfn> attribute</h5>
<h5 id=the-style-attribute><span class=secno>3.2.3.8 </span>The <dfn title=attr-style><code>style</code></dfn> attribute</h5>

<p>All <a href=#html-elements>HTML elements</a> may have the <code title=attr-style><a href=#the-style-attribute>style</a></code> content attribute set. This is a
<span>CSS styling attribute</span> as defined by the CSS Styling
Expand Down Expand Up @@ -11624,7 +11701,7 @@ <h5 id=the-style-attribute><span class=secno>3.2.3.7 </span>The <dfn title=attr-



<h5 id=embedding-custom-non-visible-data-with-the-data-*-attributes><span class=secno>3.2.3.8 </span><dfn>Embedding custom non-visible data</dfn> with the <code title=attr-data-*><a href=#attr-data-*>data-*</a></code> attributes</h5>
<h5 id=embedding-custom-non-visible-data-with-the-data-*-attributes><span class=secno>3.2.3.9 </span><dfn>Embedding custom non-visible data</dfn> with the <code title=attr-data-*><a href=#attr-data-*>data-*</a></code> attributes</h5>

<p>A <dfn id=custom-data-attribute>custom data attribute</dfn> is an attribute in no
namespace whose name starts with the string "<dfn id=attr-data-* title=attr-data-*><code>data-</code></dfn>", has at least one
Expand Down Expand Up @@ -96578,6 +96655,10 @@ <h3 class=no-num id=element-content-categories>Element content categories</h3>
<code title=attr-style-title><a href=#attr-style-title>style</a></code>
<td> Alternative style sheet set name
<td> <a href=#attribute-text>Text</a>
<tr><th> <code title="">translate</code>
<td> <a href=#attr-translate title=attr-translate>HTML elements</a>
<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 href=#attr-hyperlink-type>a</a></code>;
<code title=attr-hyperlink-type><a href=#attr-hyperlink-type>area</a></code>;
Expand Down

0 comments on commit 864baf4

Please sign in to comment.