-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
Supported formatting APIs from Intl
#774
Comments
Intl
namespaceIntl
Intl
Intl
Contributes to #774 Add support for [Intl.DateTimeFormat.prototype.formatRange()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatRange) --------- Co-authored-by: Jan Amann <[email protected]>
Hi, I was doing a bundle analysis of a next 14.2.4 app with app router and I can see that intl-messageformat is automatically bundled for the client regardless of the need to actually use it. Not sure if it relates to this issue in particular, but would be nice to have it opt-in, e.g. as peerDependency instead of forced dependency. Thanks! |
Hey @joaopbnogueira, so you're not using Which APIs from The longer-term solution is to get rid of |
Hi @amannn I am but I realize I'm working on a bit of a corner case scenario, where I am not using any of the intl-formatting/etc features (just plain text "resolution"). Anyways, for my purpose, using the null-loader for webpack and explicitly excluding (In my case I do need Cheers, |
I see! #962 should be the proper solution to your use case to handle plain messages without overhead. |
Is your feature request related to a problem? Please describe.
We currently support a subset of formatting APIs from
Intl
:Intl.DateTimeFormat
format
formatRange
(feat: Addformat.dateTimeRange
#769)formatToParts
formatRangeToParts
Intl.NumberFormat
format
formatRange
(see previous discussion in Add support for number range formatting #540)formatToParts
formatRangeToParts
Intl.ListFormat
format
formatToParts
Intl.RelativeTimeFormat
format
formatToParts
Intl.DurationFormat
(not available yet in JS runtimes)format
formatToParts
Describe the solution you'd like
There are valid use cases for every API, potentially we could support all.
For now, we'll add APIs as necessary and reported by users.
This will increase bundle size though, we should evaluate how much. Potentially we could also split
useFormatter
into separate hooks likeconst dateTimeFormat = useDateTimeFormatter()
,const relativeTimeFormat = useRelativeTimeFormat()
,const numberFormat = useNumberFormatter()
(could be introduced alongsideuseFormatter
for a longer transition period).Also note that only a subset of these formatting APIs is supported by ICU.
Describe alternatives you've considered
Supporting only a subset, e.g. none of the
ToParts
variants and asking users to implement this in userland.There are even more APIs from
Intl
(not necessarily related to formatting), so we'll likely not wrap every single API.The text was updated successfully, but these errors were encountered: