feat: add list format convenience wrapper#2223
feat: add list format convenience wrapper#2223MikaelSiidorow wants to merge 2 commits intolingui:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
vonovak
left a comment
There was a problem hiding this comment.
Hello and thanks for the PR,
my personal opinion is that these helpers should not be part of Lingui (not even the helpers for date and number).
But I'm not the one to decide :)
Could you elaborate why?
Who should? This is the best and worse part of the opensource, someone need to take decision and show the direction of the development, but every one could put it's own 5 cents into discussion. It's very hard to take all decisions alone, considering the fact i'm even not an official maintainer |
|
BTW, the PR looks good to me |
|
hi! Let me expand on it (I thought you were somehow more involved on the project @timofei-iatsenko, sorry).
People should understand that these apis are no magic, just Intl apis. And so I'd suggest they use: |
|
similar PR was previously rejected for these reasons: #1708 |
|
Then maybe move date, number and this list into helper/util package, user can import them as needed. |
|
@vonovak that's a fair enough. From other side, i found it really useful in our project. It's shorter, doing all needed essentials (memoization, current locace, etc) The @dsonet proposition is also good, but could not imagine right now a good API for this one. Currently, it's implemented as i18n instance methods, so it always has access to the current locale and works for react / vaniala and any other solution. If you create this as a separate helpers, you will have to pass i18n instance manually or pass locale and it wouldn't be much difference from just using intl apis directly. For react that could be achived by the additional hook, which will tie everethying together, but that would only for react, for other platforms has to be re-done |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2223 +/- ##
==========================================
- Coverage 77.05% 76.80% -0.25%
==========================================
Files 84 88 +4
Lines 2157 2492 +335
Branches 555 648 +93
==========================================
+ Hits 1662 1914 +252
- Misses 382 463 +81
- Partials 113 115 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I have no doubt it's useful but from a library maintenance point of view I find it problematic.
is These helper functions are 5-10 lines and we could just list them somewhere for people to copy-paste them into their projects. Zero responsibility for Lingui - it's the responsibility of Intl. |
|
Makes sense! We've already gone with a userland wrapper, since we wanted to take these into use as soon as possible. The wrappers are convenient, but probably not worth library maintenance |
Description
Add a new convenience wrapper for
Intl.ListFormatwithi18n.list. Similarly toi18n.numberis forIntl.NumberFormatandi18n.dateis forIntl.DateTimeFormat.Types of changes
Fixes #2222
Checklist