Comments (7)
-1. It isn't supported by the Intl.NumberFormat
class, so I don't think it would make sense to support it just for relative time. I'm sure it was discussed when making Intl.NumberFormat
and I don't know why they declined to add it, but if I had to guess:
- Those style guides are about using numbers in prose. It's not clear to me that they apply to the most common use cases for Javascript number formatting.
- The rules are complicated, e.g. both the major en-US style guides have rules like "if it's at the beginning of a sentence, write it out"
- The rules are varied. The sytle guides do not, in fact, agree about stuff like this, even for a specific language. For example, the Chicago Manual wants words for up to 100, whereas the AP guide says 1-10.
from proposal-intl-relative-time.
There's an API for spelling out numbers - http://userguide.icu-project.org/formatparse/numbers/rbnf-examples
Not sure if we want to aim to extend numberformat and this with it in the future but may be worth trying to figure out how such API might look like
from proposal-intl-relative-time.
@kdex Thanks for coming here and explaining this issue. Given that this proposal is already at Stage 3 in TC39, would you be up for revisiting it as a possible "v2" feature to come after Intl.RelativeTimeFormat ships?
from proposal-intl-relative-time.
@icambron Thanks a lot for the detailed explanation. As for (1), I would think that there's lots of good applications for using Intl
to construct prose. I fully understand (2) and (3) though.
@littledan In general, yes, I'm up for revisiting this, but I'm not sure what the extent of such an feature would entail, as written out numbers aren't necessarily unique. Consider 101
:
- one hundred and one
- a hundred and one
- one hundred one
- a hundred one
I'm very drawn to say that, if anything, we might want to extend Intl.NumberFormat
to allow writing out numbers, and only then would revisiting this in Intl.RelativeTimeFormat
make sense.
from proposal-intl-relative-time.
@kdex In general, this standard has been not innovating on internationalization data itself but instead following the patterns of other libraries and databases such as CLDR and ICU, and exposing something similar to JavaScript. I'd recommend working in one of those places to solve the underlying problem, and then figure out how to map the solution to JavaScript.
from proposal-intl-relative-time.
@littledan Thanks a lot for the pointers; I'll be closing this issue for now.
from proposal-intl-relative-time.
@kdex Feel free to check back here or at #tc39 on irc.freenode.net if you need to reach us for any more discussion.
from proposal-intl-relative-time.
Related Issues (20)
- Docs(MDN) : Intl.RelativeTimeFormat HOT 9
- Update status on README
- Handle cut-off logic / distance with a given Date HOT 5
- Accept BigInt in format/formatToParts HOT 2
- Ambiguous Polyfills section in docs HOT 2
- Add an option to remove the prefix HOT 2
- It would be nice to document the expected placeables in the pattern. HOT 5
- request New API for format relative time from now HOT 5
- Review @@toStringTag value HOT 1
- "an optional argument value" HOT 1
- Remove references to InitializedIntlObject HOT 3
- Create options objects with null proto HOT 1
- Question: why is minimumIntegerDigits set to 2? HOT 6
- Question: What about other NumberFormat options? HOT 2
- resolvedOptions does not need undefined check
- isFinite() does not seem to be formally defined HOT 1
- Review handling of "narrow" style HOT 6
- Incorrect "yesterday" examples HOT 6
- PartitionRelativeTimePattern accepts non-time values HOT 1
- Allow to modify the numbering system through "nu"? HOT 8
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-relative-time.