<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>23517</bug_id>
          
          <creation_ts>2013-10-14 22:19:13 +0000</creation_ts>
          <short_desc>Expose the user&apos;s preferred languages in a DOM API</short_desc>
          <delta_ts>2014-03-19 20:55:34 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ian &apos;Hixie&apos; Hickson">ian</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>ehsan</cc>
    
    <cc>erik.arvidsson</cc>
    
    <cc>ian</cc>
    
    <cc>jonas</cc>
    
    <cc>marcosscaceres</cc>
    
    <cc>mike</cc>
    
    <cc>mounir</cc>
    
    <cc>stas</cc>
    
    <cc>w3c</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>94727</commentid>
    <comment_count>0</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-14 22:19:13 +0000</bug_when>
    <thetext>Full proposal at:
   https://github.com/marcoscaceres/Locale-Preferences-API/blob/master/proposal.md</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94855</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-16 19:48:51 +0000</bug_when>
    <thetext>arv indicated support on the WHATWG list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96889</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-11-27 23:09:29 +0000</bug_when>
    <thetext>Jungshik indicated a concern, see
   http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Nov/0351.html
...and bz&apos;s response at
   http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Nov/0352.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99671</commentid>
    <comment_count>3</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-02-04 19:37:59 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8458.
Check-in comment: Add navigator.getLanguages() and &lt;body onlanguagechange=&apos;&apos;&gt;
http://html5.org/tools/web-apps-tracker?from=8457&amp;to=8458</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99704</commentid>
    <comment_count>4</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-02-04 23:17:05 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8462.
Check-in comment: Change navigator.getLanguages() to navigator.languages
http://html5.org/tools/web-apps-tracker?from=8461&amp;to=8462</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99732</commentid>
    <comment_count>5</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-02-05 02:57:17 +0000</bug_when>
    <thetext>Note that IDL arrays are on the chopping block.  What you probably want to spec here is something along the lines of case B of bug 23682 comment 0.  That is, a plain JS Array, with a new one returned if/when the value ever changes.

We really need IDL to describe this behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101726</commentid>
    <comment_count>6</comment_count>
    <who name="Mounir Lamouri">mounir</who>
    <bug_when>2014-03-02 18:30:27 +0000</bug_when>
    <thetext>Hixie, is there a place where you explain the rationale regarding the differences what you spec&apos;d and what Mozilla proposed?

I found two differences:
- .getLanguages() vs .languages;
- the event is fired on the global context instead of the Navigator object.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101745</commentid>
    <comment_count>7</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2014-03-03 06:43:41 +0000</bug_when>
    <thetext>I thought that Arv at Google also had expressed a preference for .languages over .getLanguages().

I don&apos;t really see any obvious advantages firing the event on window vs. navigator so I don&apos;t have strong preferences.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101765</commentid>
    <comment_count>8</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-03-03 19:00:33 +0000</bug_when>
    <thetext>http://krijnhoetmer.nl/irc-logs/whatwg/20140204#l-1026
Continues in: http://krijnhoetmer.nl/irc-logs/whatwg/20140205</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101794</commentid>
    <comment_count>9</comment_count>
    <who name="Mounir Lamouri">mounir</who>
    <bug_when>2014-03-03 22:48:13 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #8)
&gt; http://krijnhoetmer.nl/irc-logs/whatwg/20140204#l-1026
&gt; Continues in: http://krijnhoetmer.nl/irc-logs/whatwg/20140205

Those explains why .getLanguages() changed to be .languages. It doesn&apos;t explain why the event moved to the window. It&apos;s probably not a big deal but having an object on navigator and the associated event on the global sounds a bit odd to me [1]. Is it because Navigator isn&apos;t an EventTarget so far?

[1] Actually, my ideal design would have the change event fired on navigator.languages to keep it well isolated but some might say that it&apos;s not Web-y enough :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101879</commentid>
    <comment_count>10</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-03-05 00:00:42 +0000</bug_when>
    <thetext>The event is on Window because that way you can do &lt;body onlanguagechange=&quot;&quot;&gt; to handle it. This is consistent with how there&apos;s navigator.online, but the events (&apos;online&apos; and &apos;offline&apos;) are fired at Window, so you can do &lt;body ononline=&quot;&quot; onoffline=&quot;&quot;&gt;. Basically I was just following the way we had done it before.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101881</commentid>
    <comment_count>11</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2014-03-05 00:11:53 +0000</bug_when>
    <thetext>Sounds good to me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101894</commentid>
    <comment_count>12</comment_count>
    <who name="Mounir Lamouri">mounir</who>
    <bug_when>2014-03-05 11:17:45 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #10)
&gt; The event is on Window because that way you can do &lt;body
&gt; onlanguagechange=&quot;&quot;&gt; to handle it. This is consistent with how there&apos;s
&gt; navigator.online, but the events (&apos;online&apos; and &apos;offline&apos;) are fired at
&gt; Window, so you can do &lt;body ononline=&quot;&quot; onoffline=&quot;&quot;&gt;. Basically I was just
&gt; following the way we had done it before.

I am not sure how important consistency is in that case. I would prefer to compare the two solutions for their own benefits, not consistency and I&apos;m not convinced that there is a real benefit in being able to have an inline event handler for this while writing code like this is a bit odd:
window.onlanguagechange = function() {
  updateDocumentLangueg(navigator.languages);
}

This could very quickly lead to bugs where developers would mix |window| and |navigator| and end up listening to the languagechange event on the |navigator| object or try to get the |languages| from the |window|.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101923</commentid>
    <comment_count>13</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-03-05 21:12:42 +0000</bug_when>
    <thetext>Actually I&apos;d argue the opposite. In fact, that&apos;s why I argue consistency is important. If we always put the event handler in the same place, authors are much more likely to always get it right, and the wrong case is much more likely to stand out. When we put event handlers sometimes on Navigator, sometimes on Window, sometimes on an the Array or array-like object you get from some method or other... then authors won&apos;t know what to look for.

Now, if we were arguing about this back in 1995, wondering whether to make the &quot;resize&quot; event fire on Window or on Screen, then I would be totally on your side, and would agree that we should fire change notification events as close to the objects that represent the changed data as possible. But that decision was made long before I was around, and changing it now would not make things less confusing, it would just make things more inconsistent. IMHO.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102674</commentid>
    <comment_count>14</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-03-19 20:55:34 +0000</bug_when>
    <thetext>Marking WORKSFORME since I&apos;m not clear on what needs changing here.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>