Skip to content
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

Consider renaming of the macro components #1908

Open
thekip opened this issue Apr 5, 2024 · 2 comments
Open

Consider renaming of the macro components #1908

thekip opened this issue Apr 5, 2024 · 2 comments

Comments

@thekip
Copy link
Collaborator

thekip commented Apr 5, 2024

Extracted from here

I believe the initial idea for macro was a "subset" of the original params from runtime versions (as original author said). So they signatures originally had to match to each other.

But since then react/js ecosystem shifted towards typescript and quality typings and high type safety become a more valuable than ever. That resulted in changes in lingui, where runtime and macro version got they own typings with different signatures to highlight for developers different usages of macro/runtime versions.

So now we have Trans from /react and /Trans from macro which are diffrent components. This PR will add useLingui from /macro in additional to /react.
This is indeed confusing. It's also confusing for IDEs, they can automatically add import to incorrect symbol and user may spend hours to understand why it doesn't work as expected.

I think, maybe it's time to change the naming to something more explicit?

Trans / TransM and useLingui / useLinguiM

The Plural, Select and SelectOrdinal don't have runtime counterparts, they are transpiled to Trans, but i believe they should be renamed to follow the same naming convention:

PluralM SelectM and SelectOrdinalM

What do you think? What would be a better name for Macro version? Do you think this is worth the discussion, or it's fine how it is right now?

@andrii-bodnar
Copy link
Contributor

I was thinking about renaming the macro Trans -> trans. These M suffixes don't feel well.

Still don't have a good idea about the useLingui naming.

@thekip
Copy link
Collaborator Author

thekip commented Apr 5, 2024

I saw this particular pattern with some react libs when they transitioned to functional components and created OverlayView and OverlayViewF, Polyline and PolylineF.

I actually OK with current naming, wanted to gather more feedback from people.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants