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

Allow named components in Trans in @lingui/macro #1188

Open
fdev opened this issue Jan 7, 2022 · 13 comments
Open

Allow named components in Trans in @lingui/macro #1188

fdev opened this issue Jan 7, 2022 · 13 comments

Comments

@fdev
Copy link

fdev commented Jan 7, 2022

The documentation of Trans has the following example:

<Trans id="Read the <0>docs</0>." components={{0: <a href="/docs" />}} />

Since the number tags don't provide much context to the translator I was hoping I could use named tags instead as such:

<Trans id="Read the <link>docs</link>." components={{link: <a href="/docs" />}} />

Unfortunately, it seems only numbered tags are supported.

@semoal
Copy link
Contributor

semoal commented Jan 12, 2022

Yep, it's a nice addition. Also related to #1185

@stale
Copy link

stale bot commented Mar 15, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Mar 15, 2022
@fdev
Copy link
Author

fdev commented Mar 15, 2022

I'm replying to keep this issue from going stale. I would still like to see this implemented.

@stale stale bot removed the wontfix label Mar 15, 2022
@stale
Copy link

stale bot commented May 25, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label May 25, 2022
@fdev
Copy link
Author

fdev commented May 26, 2022

I'm replying (again) to keep this issue from going stale. I would still like to see this implemented.

@stale stale bot removed the wontfix label May 26, 2022
@stale
Copy link

stale bot commented Jul 30, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 30, 2022
@fdev
Copy link
Author

fdev commented Jul 30, 2022

I'm replying (again again) to keep this issue from going stale. I would still very much like to see this implemented.

@stale stale bot removed the wontfix label Jul 30, 2022
@stale
Copy link

stale bot commented Sep 30, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@thekip
Copy link
Collaborator

thekip commented Jan 24, 2023

According to the docs this should be already supported look at last line in the list https://lingui.js.org/releases/migration-3.html#lingui-react

Did you try it with version 3?

@Martin005
Copy link
Contributor

Martin005 commented Feb 3, 2023

@thekip The Trans component in @lingui/macro doesn't currently support it.
On the other hand, the Trans component in @lingui/react should support it as mentioned in the Migration guide you posted, but it is not working there. I have created an issue #1400 which describes the issue in @lingui/react.

Let's leave this issue for implementing the "named components" in the Trans component in @lingui/macro.

@Martin005 Martin005 changed the title Allow named components in Trans Allow named components in Trans in @lingui/macro Feb 3, 2023
@thekip
Copy link
Collaborator

thekip commented Feb 3, 2023

@Martin005 it's unrelated to macro.

@andrii-bodnar
Copy link
Contributor

it's unrelated to macro.

@thekip could you please explain in more detail what you mean?

@thekip
Copy link
Collaborator

thekip commented Feb 7, 2023

it was never asked for the Macro. The topic starter mentioned the doc of the macro because there are examples how macro transpiled to component, but the actual question was about component, not a macro.

Macro doesn't pass thru itself components and values properties, they are populated automatically.

Implementing named components in macro it's a separate feature which should be carefully designed.

@Martin005 Martin005 removed their assignment Feb 8, 2023
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

5 participants