-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add navigator.locales for user preferences #68
Comments
The idea of having the Locale API to transform nice verbose objects like {tz: "Asia/Jerusalem"} into respective BCP 47 "-u-tz-jerusalm" sounds interesting to me. This could be also used for any other Unicode extensions like numbering system ( |
Three settings that would be interesting for us to see how they fit are:
If I understand the proposal correct:
Then, we'd expect environment to build things like |
I've re-read the issue description and just noticed my comment was completely off. Please, could you clarify your initial statement? I got confused when you say there are already two languagues for specifying options to a locale. Is this related to formatters? Because, the current specification doesn't actually allow such choice. For example, Are you suggesting a change in the internals only, or does it have implications on how to use the formatters too? For example, does your suggestion imply that info like calendar, timezone, currency could now be passed either via locale or key-value pair options? Would formatters accept either a locale string or a locale instance? Thanks |
OK, good catch. My suggestion would be to change that part of the spec to actually not ignore things like Faithfully representing and using all data in both of them is a project which would take a bunch of work, and could be done incrementally. I don't think we need to do it all at once--we can implement The strawman suggestion was that formatters would end up accepting a locale instance where they currently accept a locale string simply by calling ToString() on the locale instance, and then end up parsing that into the options again. But there are other ways we could phrase the spec, like by checking whether it is an |
I really like this proposal, and would be happy to add I'd like someone here to work out an initial proposal for a few properties that would be useful to include in such an object, along with their corresponding serialization behavior. |
We discussed this idea some more this morning. Sounds like one piece that's needed is a Locale class that has methods to get various pieces of data out, rather than an object that's already populated with fields for everything. It seems to me like having an array of locales is the most general thing, perhaps denormalized but it seems more future-proof. |
side note: A request header with the locales with extensions should also be added, e.g.: |
In general browsers are loathe to add new headers (extra bytes) to every request. Also fingerprinting is just as much a concern for HTTPS sites as for insecure ones so there's no reason to restrict. Finally I think q factors are out of vogue these days? I am not too knowledgeable on the HTTP side of things though, so it would be good to get an implementer comment from someone who is. I might just be wrong about much of the above. Maybe @mnot could lend his wisdom on how much of a good idea or not such a header is. |
I think the fingerprinting question is the biggest potential blocker; sending it in a header without any server action changes it from active fingerprinting (i.e., you can tell if a script probes this info and sends it back to the server) vs. passive (you have no idea if they're using it, because you send it on every request). Assuming that doesn't kill it, a few things to keep in mind:
|
@mnot if the q-values is an option, and the absolutely easiest way to do this, that works for me. I just want to make sure that if we introduce |
Kickstarted a bug to add @domenic - do we have enough consensus here to push it to DOM? If so, would you be willing to start the conversation there? |
I'd be happy to champion this change in ECMA402 spec. |
Before we make a change like this with respect to the DOM/HTTP headers, I'd like feedback from the W3C TAG on fingerprinting-- @slightyoff would we need a user permission to expose more data that would give more information about a user agent's configuration that could lead to fingerprinting? |
Hey all, So the TAG considered this pretty deeply last year. There are many bits of data that browsers already leak and, in general, it's very very difficult to design around adding new ones. Therefore, we don't. Instead, we want to avoid intentional and unclearable supercookies. The primary question from my perspective is: how much of this data is already available in other observable ways in the browser? Is there anything about the spec that would prevent this from being user-settable or user-resettable (it doesn't seem so at first glance)? Thanks |
@zbraniecki so this would be navigator.locales which returns these Locale objects? Where are the Locale objects specced? Do we have implementer commitment from 2+ implementers? Do you have Gecko buy-in? Does @littledan have Blink buy-in? |
So, this data is not available or observable at the moment. In fact that's the very problem I'm trying to solve. My particular use case for the feature proposed by @littledan is to get this information. We can either expose it via API (like
I wanted to start by exposing locale strings counterparts of language tags on Since we will definitely want to keep allowing for the first argument to Intl APIs to be a string, we can decouple the idea to create a special object In other words, I think that there are four ideas here:
I'd like to initially work on the first and second since they, when coupled, give us ability to create date/time UI elements that match users preferences defined in the host OS. |
Uhh, I just realized that we need the Soo, I can champion two pieces:
And I need help to get DOM piece:
Does that sound good? |
@littledan, @caridy , @ericf, @rxaviers, @domenic ? |
That document says,
We can be sure to document the new fingerprinting surface area in the spec. Users can reset their user agent's preferences (whether it's in the OS or the browser) to system default to avoid the additional fingerprinting surface. Would that be sufficient, @slightlyoff ? |
Let's focus this particular issue on
|
This comment has been minimized.
This comment has been minimized.
Blocked pending conclusion on #416 |
See other discussion in whatwg/html#3046 |
@aphillips said in tc39/proposal-intl-locale#84:
|
More generally, the same concern above applies to user timezone and user calendar. Requiring the creation of a (very expensive) |
@justingrant I have a private (for now) doc where I am researching and exploring these. Feel free to DM me about this problem or ask for an invite. |
There are already two languages for specifying options to a locale:
"en-US"
) plus an object with further options ({ tz: "Asia/Jerusalem" }
)"en-US-u-tz-jerusalm"
)Each has some advantages:
An idea here:
resolvedOptions()
shouldn't return just a plain old object, but an instance of a special class whosetoString()
method returns the BCP47 locale for those options! This way, we get the best of all worlds. The output ofresolvedOptions()
can also then be used as the first (and only) argument to constructors likeIntl.DateTimeFormat
.These
Intl.Locale
objects can be used generally as the way of representing locale information within ECMAScript. HTML could include an Array of relevant complex Locales (not just simple locales like "en-US") innavigator.locales
, which would be usable either as a string or to get these higher-level properties; detailed user preferences could be reflected in the Locale which would be difficult to reflect in the simple navigator.language. Locales would still have own properties for things thatresolvedOptions()
currently includes as own properties, and would therefore probably be web-compatible as an upgrade. We probably couldn't just replacenavigator.language
with a Locale for web compatibility reasons, but there's no reason that the string first argument to formatters can't be more flexible (if it isn't already) by continuing to call ToString() and then parsing the BCP47.(To clarify, this isn't my idea but was something a group of us came up with yesterday.)
@domenic @ericf @caridy Thoughts?
The text was updated successfully, but these errors were encountered: