Coder Social home page Coder Social logo

Comments (6)

pret-a-porter avatar pret-a-porter commented on May 22, 2024

Hi, it is possible, in your case it would be:

<Text
 id='some.id'
 defaultMessage='Some message with {link} in the middle.'
 link={<CustomLink to='...'>link text</CustomLink>}
/>

I will check, why it does not work, when we pass function as param.

from eo-locale.

SanichKotikov avatar SanichKotikov commented on May 22, 2024

Thanks, but as I understand it requires two templates: Some message with {link} in the middle. & link text. But I'm talking about single template: Some message with <link>link text</link> in the middle.. It's more useful and some localise platforms has free/paid limitations based on strings count.

from eo-locale.

pret-a-porter avatar pret-a-porter commented on May 22, 2024

Yes, it make sense. For now, you can do it with html tags, like:

<Text
  html
  id='some.id'
  defaultMessage='Some message with <a class="%css_class%" href="{url}">link text</a> in the middle.'
  url='%url%'
/>

Therefore you can use any html syntax inside message, but jsx syntax inside message does not supported.

from eo-locale.

SanichKotikov avatar SanichKotikov commented on May 22, 2024

but jsx syntax inside message does not supported.

That's the case. I suppose, it might be a good feature.

from eo-locale.

pret-a-porter avatar pret-a-porter commented on May 22, 2024

Yeah, thank you for the idea! I will research, how it can be implemented nicely, but in general I would strongly recommend avoid using any code inside translations. It creates hard connection between translations and implementation of view.

from eo-locale.

taozhou-glean avatar taozhou-glean commented on May 22, 2024

Just curious any update on this ? ;) it would be great if we can support something similar to Trans from react-i18next. I think the benefit is that the translator will get the full context, and that can be very helpful to have accurate translations

from eo-locale.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.