Skip to content

Commit

Permalink
[t] (0) Clean up some translation-related things.
Browse files Browse the repository at this point in the history
Affected topics: DOM APIs, HTML

git-svn-id: http://svn.whatwg.org/webapps@7745 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Mar 8, 2013
1 parent db435fa commit ea7fe88
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 47 deletions.
53 changes: 37 additions & 16 deletions complete.html
Expand Up @@ -9619,26 +9619,47 @@ <h5 id=the-translate-attribute><span class=secno>3.2.3.4 </span>The <code title=
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><a href=#attr-translate>translate</a></code> 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>Each element (even non-HTML elements) 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 an <a href=#html-elements title="HTML elements">HTML element</a>'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, either the
element's <code title=attr-translate><a href=#attr-translate>translate</a></code> attribute is in the <i>inherit</i> state,
or the element is not an <a href=#html-elements title="HTML elements">HTML element</a> and thus does not have a
<code title=attr-translate><a href=#attr-translate>translate</a></code> attribute; in either case, the element's
<a href=#translation-mode>translation mode</a> is in the same state as its parent element's, 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 <a href=#translatable-attributes>translatable
attributes</a> 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>
<p>The following attributes are <dfn id=translatable-attributes>translatable attributes</dfn>:</p>

<ul class=brief><li><code title=attr-th-abbr><a href=#attr-th-abbr>abbr</a></code> on <code><a href=#the-th-element>th</a></code> elements</li>
<li><code title="">alt</code> on <code title=attr-area-alt><a href=#attr-area-alt>area</a></code>,
<code title=attr-img-alt><a href=#attr-img-alt>img</a></code>, and
<code title=attr-input-alt><a href=#attr-input-alt>input</a></code> elements</li>
<li><code title=attr-meta-content><a href=#attr-meta-content>content</a></code> on <code><a href=#the-meta-element>meta</a></code> elements, if the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute specifies a metadata name whose value is known to be translatable</li>
<li><code title="">download</code> on <code title=attr-a-download>a</code> and
<code title=attr-area-download>area</code> elements</li>
<li><code title="">label</code> on <code title=attr-menuitem-label><a href=#attr-menuitem-label>menuitem</a></code>,
<code title=attr-menu-label><a href=#attr-menu-label>menu</a></code>,
<code title=attr-optgroup-label><a href=#attr-optgroup-label>optgroup</a></code>,
<code title=attr-option-label><a href=#attr-option-label>option</a></code>, and
<code title=attr-track-label><a href=#attr-track-label>label</a></code> elements</li>
<li><code title=attr-lang><a href=#attr-lang>lang</a></code> on <a href=#html-elements>HTML elements</a>; must be "translated" to match the language used in the translation</li>
<li><code title="">placeholder</code> on <code title=attr-input-placeholder><a href=#attr-input-placeholder>input</a></code> and
<code title=attr-textarea-placeholder><a href=#attr-textarea-placeholder>textarea</a></code> elements</li>
<li><code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> on <code><a href=#the-iframe-element>iframe</a></code> elements; must be parsed and recursively processed</li>
<li><code title=attr-style><a href=#the-style-attribute>style</a></code> on <a href=#html-elements>HTML elements</a> elements; must be parsed and recursively processed (e.g. for the values of 'content' properties)</li>
<li><code title=attr-title><a href=#attr-title>title</a></code> on all <a href=#html-elements>HTML elements</a> elements</li>
<!-- <input value> is excluded since we can't predict if it interferes with server-side processing -->
</ul><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
Expand Down Expand Up @@ -83038,7 +83059,7 @@ <h4 id=the-storage-interface><span class=secno>11.2.1 </span>The <code><a href=#
equal to <var title="">value</var>, then it must have its value updated to <var title="">value</var>. If its previous value <em>is</em> equal to <var title="">value</var>, then
the method must do nothing.</p>

<p>If it couldn't set the new value, the method must throw an <code><a href=#quotaexceedederror>QuotaExceededError</a></code>
<p>If it couldn't set the new value, the method must throw a <code><a href=#quotaexceedederror>QuotaExceededError</a></code>
exception. (Setting could fail if, e.g., the user has disabled storage for the site, or if the
quota has been exceeded.)</p>

Expand Down
53 changes: 37 additions & 16 deletions index
Expand Up @@ -9619,26 +9619,47 @@ Transport Protocol"&gt;HTTP&lt;/abbr&gt; today.&lt;/p&gt;</pre> <!-- DO NOT REWR
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><a href=#attr-translate>translate</a></code> 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>Each element (even non-HTML elements) 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 an <a href=#html-elements title="HTML elements">HTML element</a>'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, either the
element's <code title=attr-translate><a href=#attr-translate>translate</a></code> attribute is in the <i>inherit</i> state,
or the element is not an <a href=#html-elements title="HTML elements">HTML element</a> and thus does not have a
<code title=attr-translate><a href=#attr-translate>translate</a></code> attribute; in either case, the element's
<a href=#translation-mode>translation mode</a> is in the same state as its parent element's, 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 <a href=#translatable-attributes>translatable
attributes</a> 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>
<p>The following attributes are <dfn id=translatable-attributes>translatable attributes</dfn>:</p>

<ul class=brief><li><code title=attr-th-abbr><a href=#attr-th-abbr>abbr</a></code> on <code><a href=#the-th-element>th</a></code> elements</li>
<li><code title="">alt</code> on <code title=attr-area-alt><a href=#attr-area-alt>area</a></code>,
<code title=attr-img-alt><a href=#attr-img-alt>img</a></code>, and
<code title=attr-input-alt><a href=#attr-input-alt>input</a></code> elements</li>
<li><code title=attr-meta-content><a href=#attr-meta-content>content</a></code> on <code><a href=#the-meta-element>meta</a></code> elements, if the <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute specifies a metadata name whose value is known to be translatable</li>
<li><code title="">download</code> on <code title=attr-a-download>a</code> and
<code title=attr-area-download>area</code> elements</li>
<li><code title="">label</code> on <code title=attr-menuitem-label><a href=#attr-menuitem-label>menuitem</a></code>,
<code title=attr-menu-label><a href=#attr-menu-label>menu</a></code>,
<code title=attr-optgroup-label><a href=#attr-optgroup-label>optgroup</a></code>,
<code title=attr-option-label><a href=#attr-option-label>option</a></code>, and
<code title=attr-track-label><a href=#attr-track-label>label</a></code> elements</li>
<li><code title=attr-lang><a href=#attr-lang>lang</a></code> on <a href=#html-elements>HTML elements</a>; must be "translated" to match the language used in the translation</li>
<li><code title="">placeholder</code> on <code title=attr-input-placeholder><a href=#attr-input-placeholder>input</a></code> and
<code title=attr-textarea-placeholder><a href=#attr-textarea-placeholder>textarea</a></code> elements</li>
<li><code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> on <code><a href=#the-iframe-element>iframe</a></code> elements; must be parsed and recursively processed</li>
<li><code title=attr-style><a href=#the-style-attribute>style</a></code> on <a href=#html-elements>HTML elements</a> elements; must be parsed and recursively processed (e.g. for the values of 'content' properties)</li>
<li><code title=attr-title><a href=#attr-title>title</a></code> on all <a href=#html-elements>HTML elements</a> elements</li>
<!-- <input value> is excluded since we can't predict if it interferes with server-side processing -->
</ul><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
Expand Down Expand Up @@ -83038,7 +83059,7 @@ callback <dfn id=portcollectioncallback>PortCollectionCallback</dfn> = void (<a
equal to <var title="">value</var>, then it must have its value updated to <var title="">value</var>. If its previous value <em>is</em> equal to <var title="">value</var>, then
the method must do nothing.</p>

<p>If it couldn't set the new value, the method must throw an <code><a href=#quotaexceedederror>QuotaExceededError</a></code>
<p>If it couldn't set the new value, the method must throw a <code><a href=#quotaexceedederror>QuotaExceededError</a></code>
exception. (Setting could fail if, e.g., the user has disabled storage for the site, or if the
quota has been exceeded.)</p>

Expand Down

0 comments on commit ea7fe88

Please sign in to comment.