Comments (6)
Or maybe even just define explicit fallback values instead of defaulting to und-001
, that way it's more clear what to do in a (theoretical) implementation which doesn't even have locale data for und-001
.
Operation | Default value |
---|---|
CalendarsOfLocale | "gregory" |
CollationsOfLocale | ??? |
HourCyclesOfLocale | "h23" |
NumberingSystemsOfLocale | "latn" |
CharacterDirectionOfLocale | "ltr" |
WeekInfoOfLocale | { [[FirstDay]]: 1, [[Weekend]]: ยซ 6, 7 ยป, [[MinimalDays]]: 1 } |
collations
seems to be a problem, because ICU4C returns the collations for the default locale when the input locale is unrecognised:
andre@andre-dev:~$ LANG=de opt/v8/d8 -e "print(new Intl.Locale('tlh').collations)"
emoji,eor,phonebk
andre@andre-dev:~$ LANG=fr opt/v8/d8 -e "print(new Intl.Locale('tlh').collations)"
emoji,eor
(When de
is the default locale, there's an additional phonebk
collation in the returned array.)
This seems a bit problematic to me.
from proposal-intl-locale-info.
I do not think we need to define the fallback behavior. The fallback is just part of the detail of how to decode locale data. Conceputally every locale has a value, the fact that the resource data in ICU does not explicit define them are just a memory optimization strategy to not duplicate the information when that information are the same as the fallback value. The fallback are just an implementation detail that CLDR define based on that data model. Conceptually each locale has every values, either explicitly encoded in the resources or implictly getting from the fallback.
from proposal-intl-locale-info.
@sffc @zbraniecki @ben-allen @gibson042 - any opinion?
from proposal-intl-locale-info.
TimeZone is exceptional because it impacts the rendered value of the data. The others are all preference-related, so it makes sense to use a CLDR fallback algorithm (which may do something such as looking up a value from likely subtags).
When no calendar information for locale is available, use the calendar identifiers in common use for the locale "und-001".
This situation, "when no calendar information for locale is available", is still fuzzy. The calendar is defined in CLDR by region, but it may be reasonable for th
, not just th-TH
, to infer the Buddhist calendar.
from proposal-intl-locale-info.
TimeZone is exceptional because it impacts the rendered value of the data. The others are all preference-related, so it makes sense to use a CLDR fallback algorithm (which may do something such as looking up a value from likely subtags).
When no calendar information for locale is available, use the calendar identifiers in common use for the locale "und-001".
This situation, "when no calendar information for locale is available", is still fuzzy. The calendar is defined in CLDR by region, but it may be reasonable for th
, not just th-TH
, to infer the Buddhist calendar.
from proposal-intl-locale-info.
The input may not be a recognised locale, for example consider new Intl.Locale("xyz")
(there isn't an ISO 639 code for xyz
) or if no CLDR data is available (new Intl.Locale("egy-Egyh")
, for Egyptian in Hieratic script). Most implementations will likely return "ltr"
for new Intl.Locale("egy-Egyh").getTextInfo().direction
, even though the correct answer should be "rtl"
.
So for bogus inputs or if no corresponding locale data is available, spec steps like:
[...] sorted in descending preference of those in common use for formatting numeric values in locale.
can't be applied, because neither the preference nor the common use can be determined.
Maybe there was a misunderstanding when I mentioned "fallback"? I didn't mean "fallback" to refer to some locale inheritance scheme, but instead what values should be used as the fallback when no data is available at all.
from proposal-intl-locale-info.
Related Issues (20)
- 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 13
- `.getTimezones()` seems problematic HOT 3
- Consistent "region" subtag requirements for getTimeZones() and getWeekInfo()/getHourCycles() HOT 8
- Tc39 HOT 1
- Possible of addition of Intl.Locale.prototype.getCurrencies()? HOT 1
- Locale with -u-fw- value other than 13 value will cause assertion HOT 15
- WeekInfoOfLocale need to convert loc.[[FirstDayOfWeek]] to number before return HOT 1
- Ensure getWeekInfo will not not listen to 'rg' HOT 3
- minimalDays HOT 2
- CharacterDirectionOfLocale: Confusing reference to "characterOrder"
- CharacterDirectionOfLocale: Define if locales are maximized before lookup
- CharacterDirectionOfLocale: Returns "ltr" for scripts without any character direction
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.