Skip to content
This repository has been archived by the owner on Mar 5, 2020. It is now read-only.

Are we still seriously using LinkAnchorSwap? #2169

Open
Pomax opened this issue Sep 2, 2016 · 3 comments
Open

Are we still seriously using LinkAnchorSwap? #2169

Pomax opened this issue Sep 2, 2016 · 3 comments

Comments

@Pomax
Copy link
Contributor

Pomax commented Sep 2, 2016

It's only used in a handful of places, it might be worth reengineering it out of existence...

@ScottDowne
Copy link
Contributor

ScottDowne commented Sep 7, 2016

It's also a huge pain to localize around, as it's not html, and cannot be used with the formattedHTML thingy.

@Pomax
Copy link
Contributor Author

Pomax commented Sep 11, 2016

I do not know what that is - the one thing a single link component makes easy is localisation, as you'd only need one place in which to detect and process localisation.

@ScottDowne
Copy link
Contributor

ScottDowne commented Sep 12, 2016

I was on my phone when I commented, so I didn't bother to copy and paste links as reference.

A better explanation why component based links are hard because of l10n:

Say I have a string like this Click <a href="https://findoutmore.com">here</a> to find out more I need to localize. I can:

  1. Add the string Click <a href="https://findoutmore.com">here</a> to find out more to a .properties file and use <FormattedHTMLMessage> https://github.com/yahoo/react-intl/wiki/Components#formattedhtmlmessage which allows the HTML to exist inside the string and be used in react-intl. Tricky bit here is components cannot live in that string, that I know of, and have it still render in <FormattedHTMLMessage>

You also have this issue if you want a single link component. You probably want to keep this as a simple <a> tag.

You can fairly easily build localized links though, if you change the string to Click <a href="{link}">here</a> to find out more Then build the link with this.context.intl.locale and pass it into <FormattedHTMLMessage> as a variable.

If there is a way to render components in strings living in a .properties file though, that would be ideal, I just don't know how to do it without being way more complex than a simple <a>

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

No branches or pull requests

2 participants