-
Notifications
You must be signed in to change notification settings - Fork 382
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
feat: add ph() and explicit labels for placeholders #2092
base: next
Are you sure you want to change the base?
feat: add ph() and explicit labels for placeholders #2092
Conversation
@timofei-iatsenko is attempting to deploy a commit to the Crowdin Team on Vercel. A member of the Team first needs to authorize it. |
size-limit report 📦
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #2092 +/- ##
==========================================
- Coverage 76.66% 75.80% -0.87%
==========================================
Files 81 87 +6
Lines 2083 2389 +306
Branches 532 626 +94
==========================================
+ Hits 1597 1811 +214
- Misses 375 459 +84
- Partials 111 119 +8 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
68b0809
to
aaa680f
Compare
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
aaa680f
to
593e1e7
Compare
Description
Adds a way to give an explicit name for placeholders in the messages. There are two syntaxes supported:
And with explicit
ph
helper:Shortcut syntax is also supported:
In the JSX
Note, that Children type for the Trans component was amended to allow passing an object. However, inner elements in the Trans will not allow that, and the only one way to use is a
ph()
helper macro, which basically a type helper to mitigate this issue.PS
Actuallyeverythingg could be covered with
ph()
helper, but i've found syntax without it much easier to write in day to day routine. So i decided to left both of them. For most of cases just{name: getName()}
and for cases where it doesn't work theph
.The implementation is almost the same, to support both of the methods it's additional 10 lines of code.
Let me know what you think about it.
Types of changes
Fixes # (issue)
Checklist