Comments (8)
I think there are three possible approaches we could consider for this issue
- Keep the status quo
- Change getWeekInfo() and getHourCycles() to also include the following step
If the unicode_language_id production of locale does not contain the ["-" unicode_region_subtag] sequence, return undefined.
- Change getTimeZones() spec to return the value after adding likelySubtag
from proposal-intl-locale-info.
new Intl.Locale("en-US").getTimeZones()
// ["America/New_York", "America/Chicago", ...]
new Intl.Locale("en").getTimeZones()
// Current: undefined
// Anba suggestion: same as "en-US" based on likely subtags
// Shane suggestion: ["UTC"]
// Justin suggestion: []
from proposal-intl-locale-info.
We discussed this in 2023-09-07 TG2, with the following options:
- maximize the locale to get the Region then to get the TimeZone
- return ["UTC"]
- return []
- return undefined (AS IS in the current spec text)
attendees supprt keeping the current spec text that return undefined after consider the above options. Close this issue.
from proposal-intl-locale-info.
from proposal-intl-locale-info.
@sffc If it's not acceptable for getTimeZones()
to use likely-subtags data to fill in missing regions, why is it acceptable that getWeekInfo()
uses likely-subtags data to fill in missing regions?
from proposal-intl-locale-info.
Good question; the time zone impacts the actual numeric result of the data, whereas week info and hour cycle are about display preferences that have some impact on the layout but don't change the underlying quantity. It is therefore important to make a conscious choice about the time zone.
from proposal-intl-locale-info.
And if we keep the current approach where the region subtag is only strictly required for getTimeZones()
, but not for getWeekInfo()
, should ICU4X follow suite and also fill in missing region subtags for unicode-org/icu4x#2999, or should this be done in the ICU4X caller?
The relevant ICU4C code is:
- Preprocessing to fill in missing region subtags: https://searchfox.org/mozilla-central/rev/6ee872a465eeb8769331c8cad74d136c9f13b67f/intl/icu/source/i18n/calendar.cpp#3862-3883
- Fallback to 001 if no region data was found: https://searchfox.org/mozilla-central/rev/6ee872a465eeb8769331c8cad74d136c9f13b67f/intl/icu/source/i18n/calendar.cpp#3920-3930
from proposal-intl-locale-info.
I anticipate that in places where a default can be reasonably derived, such as week info, likely subtags will be used during lookup.
from proposal-intl-locale-info.
Related Issues (20)
- Change CharacterDirectionOfLocale and WeekInfoOfLocale to receive an Intl.Locale object? HOT 1
- CreateArrayFromListOrRestricted can be simplified HOT 1
- Canonicalise time zones in TimeZonesOfLocale
- Define behaviour when no time zone is used within a region HOT 5
- [[Weekend]] ordering HOT 2
- CharacterDirectionOfLocale doesn't handle top-to-bottom and bottom-to-top scripts HOT 1
- CharacterDirectionOfLocale doesn't take script and region subtags into account HOT 1
- Intl.Locale.prototype.textInfo is missing "lineOrder" information HOT 1
- "direction" property in Intl.Locale.prototype.textInfo is possibly ambiguous HOT 2
- textInfo.direction is a very simplified model of reality HOT 19
- The textInfo getter seems unwell HOT 5
- Reverse date creation HOT 1
- Add support for -u-fw and other Unicode extensions that could impact the result HOT 12
- `.getTimezones()` seems problematic HOT 3
- Tc39 HOT 1
- Possible forward-compatibility issue in Intl.Locale.prototype.getTimeZones()? HOT 26
- Possible of addition of Intl.Locale.prototype.getCurrencies()? HOT 1
- Define fallback behaviour in {Calendars,Collations,HourCycles,NumberingSystems,CharacterDirection,WeekInfo}OfLocale HOT 6
- Locale with -u-fw- value other than 13 value will cause assertion HOT 14
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-info.