Skip to content
Permalink
Browse files

[cgiow] (0) Add navigator.getLanguages() and <body onlanguagechange=''>

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

git-svn-id: http://svn.whatwg.org/webapps@8458 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Feb 4, 2014
1 parent df69e87 commit bcbe3fb616542245a3e03c223bf70d8389840c86
Showing with 147 additions and 7 deletions.
  1. +48 −3 complete.html
  2. +48 −3 index
  3. +51 −1 source
<dd><code title=handler-window-onbeforeprint><a href=#handler-window-onbeforeprint>onbeforeprint</a></code></dd>
<dd><code title=handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code></dd>
<dd><code title=handler-window-onhashchange><a href=#handler-window-onhashchange>onhashchange</a></code></dd>
<dd><code title=handler-window-onlanguagechange><a href=#handler-window-onlanguagechange>onlanguagechange</a></code></dd>
<dd><code title=handler-window-onmessage><a href=#handler-window-onmessage>onmessage</a></code></dd>
<dd><code title=handler-window-onoffline><a href=#handler-window-onoffline>onoffline</a></code></dd>
<dd><code title=handler-window-ononline><a href=#handler-window-ononline>ononline</a></code></dd>
<tr><td><dfn id=handler-window-onbeforeprint title=handler-window-onbeforeprint><code>onbeforeprint</code></dfn> <td> <code title=event-beforeprint><a href=#event-beforeprint>beforeprint</a></code>
<tr><td><dfn id=handler-window-onbeforeunload title=handler-window-onbeforeunload><code>onbeforeunload</code></dfn> <td> <code title=event-beforeunload><a href=#event-beforeunload>beforeunload</a></code>
<tr><td><dfn id=handler-window-onhashchange title=handler-window-onhashchange><code>onhashchange</code></dfn> <td> <code title=event-hashchange><a href=#event-hashchange>hashchange</a></code> <!-- new -->
<tr><td><dfn id=handler-window-onlanguagechange title=handler-window-onlanguagechange><code>onlanguagechange</code></dfn> <td> <code title=event-languagechange><a href=#event-languagechange>languagechange</a></code> <!-- new -->
<tr><td><dfn id=handler-window-onmessage title=handler-window-onmessage><code>onmessage</code></dfn> <td> <code title=event-message><a href=#event-message>message</a></code> <!-- new for postMessage -->
<tr><td><dfn id=handler-window-onoffline title=handler-window-onoffline><code>onoffline</code></dfn> <td> <code title=event-offline><a href=#event-offline>offline</a></code> <!-- new -->
<tr><td><dfn id=handler-window-ononline title=handler-window-ononline><code>ononline</code></dfn> <td> <code title=event-online><a href=#event-online>online</a></code> <!-- new -->
attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onbeforeprint title=handler-window-onbeforeprint>onbeforeprint</a>;
attribute <a href=#onbeforeunloadeventhandler>OnBeforeUnloadEventHandler</a> <a href=#handler-window-onbeforeunload title=handler-window-onbeforeunload>onbeforeunload</a>;
attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onhashchange title=handler-window-onhashchange>onhashchange</a>;
attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onlanguagechange title=handler-window-onlanguagechange>onlanguagechange</a>;
attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onmessage title=handler-window-onmessage>onmessage</a>;
attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onoffline title=handler-window-onoffline>onoffline</a>;
attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-ononline title=handler-window-ononline>ononline</a>;
<pre class=idl>[NoInterfaceObject, Exposed=Window,Worker]
interface <dfn id=navigatorlanguage>NavigatorLanguage</dfn> {
readonly attribute DOMString? <a href=#dom-navigator-language title=dom-navigator-language>language</a>;
DOMString[] <a href=#dom-navigator-getlanguages title=dom-navigator-getLanguages>getLanguages</a>();
};</pre>

<dl class=domintro><dt><var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-language><a href=#dom-navigator-language>language</a></code></dt>
<dd>
<p>Returns a language tag representing the user's preferred language.</p>
</dd>

</dl><div class=impl>
<dt><var title="">languages</var> = <var title="">window</var> . <code title=dom-navigator><a href=#dom-navigator>navigator</a></code> . <code title=dom-navigator-getLanguages><a href=#dom-navigator-getlanguages>getLanguages</a></code>()</dt>
<dd>
<p>Returns an array of language tags representing the user's preferred languages, with the most preferred language first.</p>
<p>The most preferred language is the one returned by <code title=dom-navigator-language><a href=#dom-navigator-language>navigator.language</a></code>.</p>
</dd>

</dl><p class=note>A <code title=event-languagechange><a href=#event-languagechange>languagechange</a></code> event is fired at the
<code><a href=#window>Window</a></code> or <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object when the user agent's understanding
of what the user's preferred languages are changes.</p>

<div class=impl>

<dl><!--
<dt><dfn title="dom-navigator-browserLanguage"><code>browserLanguage</code></dfn></dt> <!- - Opera and IE only - ->
<dt><dfn title="dom-navigator-userLanguage"><code>userLanguage</code></dfn></dt> <!- - Opera and IE only - ->
--><!-- at time of testing, this was supported by Opera, Safari, and Mozilla only --><dt><dfn id=dom-navigator-language title=dom-navigator-language><code>language</code></dfn></dt>
<dd><p>Must return a valid BCP 47 language tag representing either <a href=#a-plausible-language>a plausible
language</a> or the user's preferred language. <a href=#refsBCP47>[BCP47]</a></dd>
language</a> or the user's most preferred language. <a href=#refsBCP47>[BCP47]</a></dd>

<dt><dfn id=dom-navigator-getlanguages title=dom-navigator-getLanguages><code>getLanguages()</code></dfn></dt>
<dd><p>Must return an array of valid BCP 47 language tags representing either one or more <a href=#a-plausible-language title="a plausible language">plausible languages</a>, or the user's preferred languages,
ordered by preference with the most preferred language first. <a href=#refsBCP47>[BCP47]</a></dd>

</dl><p>To determine <dfn id=a-plausible-language>a plausible language</dfn>, the user agent should bear in mind the following:</p>

suggested; if all users of the service use that same value, that reduces the possibility of
distinguishing the users from each other.</li>

</ul></div>
</ul><p>To avoid introducing any more fingerprinting vectors, user agents should use the same list for
the APIs defined in this function as for the HTTP <code title=http-accept-language>Accept-Language</code> header.
<a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
</p>

<p>Whenever the <code title=dom-navigator-getLanguages><a href=#dom-navigator-getlanguages>navigator.getLanguages()</a></code> method
of a <code><a href=#window>Window</a></code> or <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object would start returning a new set
of language tags, the user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
event</a> named <code title=event-languagechange><a href=#event-languagechange>languagechange</a></code> at the
<code><a href=#window>Window</a></code> or <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object.</p>

<p>The <a href=#task-source>task source</a> for this <a href=#concept-task title=concept-task>task</a> is the
<a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>

</div>




void <a href=#dom-workerglobalscope-close title=dom-WorkerGlobalScope-close>close</a>();
attribute <a href=#onerroreventhandler>OnErrorEventHandler</a> <a href=#handler-workerglobalscope-onerror title=handler-WorkerGlobalScope-onerror>onerror</a>;
attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-workerglobalscope-onlanguagechange title=handler-WorkerGlobalScope-onlanguagechange>onlanguagechange</a>;
attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-workerglobalscope-onoffline title=handler-WorkerGlobalScope-onoffline>onoffline</a>;
attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-workerglobalscope-ononline title=handler-WorkerGlobalScope-ononline>ononline</a>;


<table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
<tbody><tr><td><dfn id=handler-workerglobalscope-onerror title=handler-WorkerGlobalScope-onerror><code>onerror</code></dfn> <td> <code title=event-error><a href=#event-error>error</a></code>
<tr><td><dfn id=handler-workerglobalscope-onlanguagechange title=handler-WorkerGlobalScope-onlanguagechange><code>onlanguagechange</code></dfn> <td> <code title=event-languagechange><a href=#event-languagechange>languagechange</a></code> <!-- new -->
<tr><td><dfn id=handler-workerglobalscope-onoffline title=handler-WorkerGlobalScope-onoffline><code>onoffline</code></dfn> <td> <code title=event-offline><a href=#event-offline>offline</a></code> <!-- new -->
<tr><td><dfn id=handler-workerglobalscope-ononline title=handler-WorkerGlobalScope-ononline><code>ononline</code></dfn> <td> <code title=event-online><a href=#event-online>online</a></code> <!-- new -->
</table><hr><p class=note>For <a href=#data-protocol title="data protocol"><code title="">data:</code> URLs</a>, this is
<code title=handler-window-onbeforeprint><a href=#handler-window-onbeforeprint>onbeforeprint</a></code>;
<code title=handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code>;
<code title=handler-window-onhashchange><a href=#handler-window-onhashchange>onhashchange</a></code>;
<code title=handler-window-onlanguagechange><a href=#handler-window-onlanguagechange>onlanguagechange</a></code>;
<code title=handler-window-onmessage><a href=#handler-window-onmessage>onmessage</a></code>;
<code title=handler-window-onoffline><a href=#handler-window-onoffline>onoffline</a></code>;
<code title=handler-window-ononline><a href=#handler-window-ononline>ononline</a></code>;
<td> <code title=event-keyup><a href=#event-keyup>keyup</a></code> event handler
<td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

<tr><th id=ix-handler-window-onlanguagechange> <code title="">onlanguagechange</code>
<td> <code title=handler-window-onlanguagechange><a href=#handler-window-onlanguagechange>body</a></code>
<td> <code title=event-languagechange><a href=#event-languagechange>languagechange</a></code> event handler for <code><a href=#window>Window</a></code> object
<td> <a href=#event-handler-content-attributes title="event handler content attributes">Event handler content attribute</a>

<tr><th id=ix-handler-onload> <code title="">onload</code>
<td> <a href=#handler-onload title=handler-onload>HTML elements</a>
<td> <code title=event-load><a href=#event-load>load</a></code> event handler
<td> Form controls
<td> Fired at controls during form validation if they do not satisfy their constraints

<tr><!-- languagechange --><td> <dfn id=event-languagechange title=event-languagechange><code>languagechange</code></dfn>
<td> <code><a href=#event>Event</a></code>
<td> Global scope objects
<td> Fired at the global scope object when the user's preferred languages change

<tr><!-- load --><td> <dfn id=event-load title=event-load><code>load</code></dfn>
<td> <code><a href=#event>Event</a></code>
<td> <code><a href=#window>Window</a></code>, elements

0 comments on commit bcbe3fb

Please sign in to comment.
You can’t perform that action at this time.