-
Notifications
You must be signed in to change notification settings - Fork 87
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
localizing <Link> (react-router-dom) #54
Comments
The issue here is I'm going to close this issue as it's a duplicate of #46. Please feel free to continue the conversation in that issue. |
@mehmetnyarar In the meantime, although not ideal I'd just split your translation strings: {
"goto.homepage.prefix" "Go to",
"goto.homepage.label" "home page",
"goto.homepage.suffix" "copy that goes after link goes here."
}
// then in your react component
<p>{ translate('goto.homepage.prefix') } <Link to='/home'>{translate('goto.homepage.label')}</Link> { translate('goto.homepage.suffix') }</p> |
@ryandrewjohnson thanks for your time. Unfortunately that approach won't work for me since the structure of the sentence changes between languages (en, ru, tr). I've created a child component which is basically a switch statement and returns JSX based on active language. For now it works for 3 languages but the solution won't scale once you have many languages or many components needing inline links . |
Hi,
I'd like to provide links in the translation but they shouldn't reload the page.
Ways I have tried so far:
"goto.homepage": "Go to <Link to='/home'>home page</Link>..."
Translates but it's not clickable.
"goto.homepage": "Go to ${link}..."
Inside component:
Returns [object Object]
The text was updated successfully, but these errors were encountered: