Comments (11)
My perspective is that Intl.Locale
is a view of the language tag and is meant to facilitate operations on the tags.
It has, in result, no reason to depend on available data.
My perspective is that all it wraps is a set of algorithms to parse any BCP47 language tag, modify it and serialize it into its canonical form.
The datasets available for each Intl formatter are identified using the supportedLocalesOf
method on them, and have no correlation with this API.
from proposal-intl-locale.
Related question #8--should we validate sub-components of locales? We probably shouldn't throw an exception on missing data for a region that exists when we can fall back to the parent locale, but there are other cases that are less clear-cut.
from proposal-intl-locale.
What do you mean by validate? Validate if it's a BCP47 compliant? We do this. Validate that Intl has data for it? That's what Intl.*.supportedLocalesOf
is for, no?
What do you mean fallback on the parent locale?
from proposal-intl-locale.
Well, I'm using your word from #8. There are a few different levels we could do this at--whether we have the data on the system, whether it's in a list of known existing regions/scripts, or syntactically valid, as you say.
It'd be good to hear more on this bug from people who are more in favor of throwing exceptions on unknown locales/locale components. For my part, I have to investigate what other libraries do; I think I'll have time for this in a month or so.
from proposal-intl-locale.
Well, I'm using your word from #8.
In #8 I only meant BCP47 canonicalization.
whether we have the data on the system, whether it's in a list of known existing regions/scripts, or syntactically valid, as you say.
I really struggle to understand why do you want to connect to it CLDR data carried by the browser. This is a glorified canonicalizeLanguageTag
that allows to operate on language tags.
It's not connected to any particular formatter or its data.
known regions/scripts
would basically make it useless for operations on correct language tags for which the browser doesn't carry data. Why would you want it?
Once again, if the goal is to verify if the data is there, supportedLocalesOf
is the API for it.
from proposal-intl-locale.
In #8 I only meant BCP47 canonicalization.
I see, I didn't realize.
I really struggle to understand why do you want to connect to it CLDR data carried by the browser.
I don't really want to; I'm trying to represent the points of view expressed in the committee. We'd better find others who want to represent that point of view. cc @bterlson .
from proposal-intl-locale.
I checked several other programming languages' standard libraries for their behavior on unsupported locales. Generally, unsupported locales can be constructed; using them sometimes falls back to a default and sometimes causes an error. I think we should support constructing locale objects which lack data, but if we add more operations, e.g., to get display names, then consider throwing errors on missing data rather than return data for the wrong locale.
from proposal-intl-locale.
There are multiple levels of conformance [0].
"well-formed" is any tag that follows the ABNF. "valid" is any tag that follows ABNF and contains tag registered in the IANA (or grandfathered).
My recommendation is for Intl.Locale
to support "well-formed" tags and not support grandfathered at all.
We can consider later adding isValid
test.
[0] https://tools.ietf.org/html/bcp47#section-2.2.9
from proposal-intl-locale.
The current proposal doesn't support grandfathered locales, but it does support locales with no data.
from proposal-intl-locale.
OK, it seems like the current specification is acceptable, so closing this issue. Please reopen if you have any more concerns.
from proposal-intl-locale.
We reviewed this discussion at the January ECMA 402 VC meeting. The consensus was to continue accepting unsupported locales, given the independent utility in just parsing and processing a locale.
from proposal-intl-locale.
Related Issues (20)
- Modified CanonicalizeLocaleList does not accept Intl.Locale instances when provided as the only argument HOT 1
- Using Unicode locale ID vs BCP 47 in our spec HOT 51
- Resolved value for Unicode extension values when "true" is removed? HOT 4
- Simplified the change to 2.1 CanonicalizeLocaleList HOT 3
- Docs(MDN) Documentation for Intl.Locale HOT 17
- Does hourCycle exist unconditionally? HOT 3
- Not all RFC 5646 production names updated HOT 3
- Move "get caseFirst" after "get calendar"
- Update references to match current UTS 35 spec HOT 11
- Use `type` production from UTS35
- Directly use unicode_language_id in "get baseName"
- Need to test for SameValue(r.[[kn]], "") in addition to SameValue(r.[[kn]], "true")
- no validation of value of extensions in tag? HOT 8
- CanonicalizeLanguageTag should remove duplicate attributes/keywords in a Unicode extension, consistent with Intl.Locale HOT 6
- Getting the default locale HOT 10
- Drop this proposal in favor of a more general user settings object HOT 6
- Spec is vague regarding internal data structure representation HOT 12
- Canonicalise Unicode extensions options added through ResolveLocale HOT 8
- CanonicalizeUnicodeLocaleId should only perform step 1 of "BCP 47 Language Tag to Unicode BCP 47 Locale Identifier" HOT 3
- Archive repository, redirect draft to ecma402 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proposal-intl-locale.