-
Notifications
You must be signed in to change notification settings - Fork 390
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
refactor(macro): split and expose internals to be used in Vue macro #1976
refactor(macro): split and expose internals to be used in Vue macro #1976
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #1976 +/- ##
==========================================
+ Coverage 76.66% 80.65% +3.98%
==========================================
Files 81 82 +1
Lines 2083 2290 +207
Branches 532 604 +72
==========================================
+ Hits 1597 1847 +250
- Misses 375 427 +52
+ Partials 111 16 -95 ☔ View full report in Codecov by Sentry. |
@thekip Thank you! Could you please describe the new We should probably decouple exposing internals for Vue integration and the |
i don't want to split this into two, since this This macro prints argument placeholder as raw without any additional brackets. This is useful if you want to construct ICU expression manually but still want to use all benefits of macro. Say i want to construct a plural icu expression without using a plural macro: // without `arg` macro
t`{${count}, plural, one {}, other {}}` We will receive a broken icu because of brackets around a i18n.t({
id: "<hash>",
message: "{{count}, plural, one {}, other {}}",
values: {count: count}
}) With the t`{${arg(count)}, plural, one {}, other {}}`
i18n.t({
id: "<hash>",
message: "{count, plural, one {}, other {}}",
values: {count: count}
}) This is especially useful if you want to create complex ICU expressions and want to use ICU syntax directly. For Vue this is the only one way to implement Plural functionality in templates. There is no counterpart for
I don't think useLingui or arg macro are blocking the release. They are not the core functionality and users could decide not to use them if they use SWC version. We can add a "feature parity" table on the SWC plugin page and note which features are implemented and which are not. Implementing useLingui hook is extremely difficult in Rust actually, that's why I was against this feature originally considering all the consequences of porting it to the SWC |
Okay, now I get the motivation.
We can accept this in the first release and implement the normal Vue Such inconsistencies between Babel and SWC implementations will cause more and more confusion for users. It's better not to release some feature than to release it in half, especially when we have quite a large amount of developers using the SWC plugin. Also, full feature support makes it much easier to write documentation. |
There is no way to implement Plural in Vue the same way as in React JSX. So there are no plans to implement a "normal" Plural for Vue.
Would you be interested in contributing to the SWC plugin? Unfortunately, I don't have enough motivation to port features that I don't personally use. Alternatively, you can create a bounty or find a sponsor to support this development effort. |
@JSteunou please share your opinion on this PR and the discussion.
I don't have any expertise in Rust. By the way, you already contributed to this feature in #1859 and lingui/swc-plugin#90. What I'm trying to convey is that such mis-synchronization between Babel and the SWC implementation is not good, and might cause more confusion than the feature brings benefit. |
# Conflicts: # packages/babel-plugin-lingui-macro/src/macroJs.ts
@andrii-bodnar This one is updated, please review it and consider merging. This makes working on Vue integration easier and PR would have fewer files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timofei-iatsenko thank you!
Description
extract refactoring to js macro from #1925
Also add a new macro called "arg" which unblock using native ICU syntax directly with macro such as
Types of changes
Fixes # (issue)
Checklist