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

[manager-components]: Unable to translate a link with <Trans> component #15421

Open
3 tasks
darsene opened this issue Feb 12, 2025 · 2 comments · May be fixed by #15660
Open
3 tasks

[manager-components]: Unable to translate a link with <Trans> component #15421

darsene opened this issue Feb 12, 2025 · 2 comments · May be fixed by #15660
Assignees
Labels
bug Something isn't working manager-components

Comments

@darsene
Copy link
Contributor

darsene commented Feb 12, 2025

On which entity, you would like to report a bug?

packages/manager-react-components/src/components/order

Description

According to https://react.i18next.com/latest/trans-component, a link label can be set by using trans component.
However, the OdsLink component (ODS 18) doesn't accept the label value as children prop and the translation tool doesn't allow to translate prop of a component (#15414, see detail in CMT-21344).
Therefore, which workaround can be used ?

Steps to reproduce

#15414

Browser

No response

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

No response

@darsene darsene added bug Something isn't working manager-components labels Feb 12, 2025
@tristanwagner
Copy link
Contributor

tristanwagner commented Feb 14, 2025

As I suggested I would try

Translation file

"your_key": "Some text with a <Link /> that can move depending on the language",
"your_key_link_label": "labeled link",

In your component

<Trans
  t={t}
  i18nKey="your_key"
  components={{ 
    Link: <OdsLink href={href} label={t('your_key_link_label')}/> 
    }}
/>

This way the translation team will be able to move the link depending on the language, the downside is that it is hard for them to have the full context of the translation since the label of the link is separated from the "main" text

darsene added a commit that referenced this issue Feb 25, 2025
@darsene darsene linked a pull request Feb 25, 2025 that will close this issue
1 task
@darsene
Copy link
Contributor Author

darsene commented Feb 25, 2025

Fixes in #15660

@tristanwagner @anooparveti

@anooparveti anooparveti linked a pull request Feb 26, 2025 that will close this issue
1 task
darsene added a commit that referenced this issue Feb 26, 2025
darsene added a commit that referenced this issue Mar 6, 2025
darsene added a commit that referenced this issue Mar 6, 2025
darsene added a commit that referenced this issue Mar 6, 2025
darsene added a commit that referenced this issue Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working manager-components
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants