-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
implement #1311: add new syntax for interpolation of complex types #1316
Conversation
all better now |
@cellog looks good to me -> will the old variation still work - or will this need to be published as major version changing the API |
I didn't modify any of the existing tests, and they all pass, so based on that information I do believe this is fully backwards-compatible. Things I want to add before I make it ready for review:
|
merge updates from head
ok @jamuhl here's what I propose: if you like what you see, I can also do a PR against |
also, I would LOVE to do a follow-up PR that refactors |
@cellog sure...any help is very helpful...even more with the macro, icu support, ... (which I don't use myself - so don't have the deepest understanding) |
@jamuhl just so I'm clear: are you waiting for any follow-up commits from me prior to reviewing this PR? Thanks |
@cellog no, sorry was rather busy with other stuff...I wasn't able to follow this close enough -> so I'm more or less an "ok" from your side that this is ready for review and merge/publish |
ok, I will do a round of extensive testing and let you know when it's ready. Thanks Jan! |
@jamuhl this is good to go. I'll get started on the documentation PR this week |
@jamuhl this and the documentation are good to go, release whenever ready! |
add documentation for i18next/react-i18next#1316
published in v11.9.0 |
implements #1311
Note: I assume the repo for the docs is in a separate place? I augmented the example app, but would need to update the docs as well, should the PR look good. I plan to do that as a pre-step to release if that's cool.
This is a SUBSTANTIAL addition to the API, but does not break any existing functionality. It's also worth noting that it doesn't actually change anything runtime, because all of these additions only have an effect if used inside
Trans
.It might be worth adding a check and error if any of these suckers are used OUTSIDE of a Trans, but this PR doesn't do that yet. I wanted to be sure we have a clear agreement on the structure of this new feature.
@jamuhl for your consideration.
Sample old way:
Sample new way:
The reason I chose to implement it this way was for typescript: if we do this, we can add an additional check that the interpolated variable is a
Date
instance fordate
/time
, and for numbers/plural/selectOrdinal, we can check fornumber
type, and forselect
we can check for a string type.Sample of what I have in mind for the typing:
https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgIilQ3wG4AoczAVwDsNgJa4ATFGJAHgBUA+ACgDOMKMFoBzQQC443JOAA27JAGURYyQEEoUFAE8ANHABuKUSgBGCpDIAiyowDpnZyTJS09AbQC6ASjgAb3I4ULgiGGooZgByAAtgGPIAXyo6BiY4GFAuPiF1CWlZeTAlDjVRQu1dQxMzYEtrOwc4Z0dXIo9vfyCQsIio2ISk1Jp6bMzaahALJCgeAWFKt2LFZQqNQWr9I1NzKxs4KZm5pxcoFa7fAOCw8KRI6Lh4xJS08cZmUqiUBQX85ZFORrcoFLQ6HZ1fZNI7TWZQM7tC6dTzXXp3AZPF4jd4ZZiCJDWDD-JabGTA0rrMFbCG1PYNA4yUkSREddyonq3foPQbPYZvchoJjCODAQT2DhwAC8RyQAHc4BKkBQhbQRWKAHLTaVwABMKuF8DFGwkOvwCTIlDYHAABgASQJipXJIyCOLQGA2ijWpD2x2CLUgZJe8g+v3GsHBijkY7w8Pi5RRmNwubxwNJ2Oph0R5ZJ8jfXQKePOowQTCYAkwKS60swOJzIJwQS4JBZXRqsqfOAOzhClhIXgAVk4AHo+wPknAkwXfmnpi64GWKw9q7X61BG82QK2RB5BJ3Mj3x0PR8fJ9OFD8i9nBCbxAul5XV4u6w3Ak2W229wfmEeIP2TzHf8JynENyAJIlPRvEs4ASRtMA8NAxCQQRBFAigIKQDA5yDIw4PfBD6GQ1D0PAwksKg-07wXfC4EIpDaBQtCkyAA
Checklist
npm run test