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

Nested components? #4

Closed
monder opened this issue Aug 4, 2016 · 2 comments
Closed

Nested components? #4

monder opened this issue Aug 4, 2016 · 2 comments

Comments

@monder
Copy link

monder commented Aug 4, 2016

Hey,
I'm looking for a way to insert React components into the translated string.

Use-case:
In your example https://github.com/CherryProjects/react-translate-maker#en_usjs I want to have user names clickable.

The dirty workaround would be inserting <a> into the text and use TranslateHTML. But it doesn't work if I want links to be handled by react-router's <Link> component.

I've tried passing the components to properties as it is in react-intl (Rich Text Formatting), but it just results in [object Object]
Am I missing something or this feature is not supported?

@seeden
Copy link
Collaborator

seeden commented Aug 4, 2016

Hi @monder
I added support for this. Please use the latest version of react-translate-maker (0.2.6).
Here is a small example

<LocaleProvider locale="sk_SK" adapter={adapter}>
    <TranslateHTML path="test" yourParam={<a>Asdf <Translate path="inner" /></a>} />
 </LocaleProvider>

TranslateHTML is generating HTML output. Please be careful with unsafe characters. I will add support for this to "safe" Translate component too. But I need to do some changes in the core of translate-maker.

@seeden seeden closed this as completed Aug 4, 2016
@monder
Copy link
Author

monder commented Aug 4, 2016

Cool. Thanks

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

No branches or pull requests

2 participants