Git Product home page Git Product logo

Comments (3)

ryandrewjohnson avatar ryandrewjohnson commented on May 12, 2024 2

@RoberMac so the only time the <span> should be added is when there's HTML markup detected in your translation. The reason for this is behind the scenes I use React's dangerouslySetInnerHTML to render HTML.

I've looked into adding the dangerouslySetInnerHTML as a prop on the <Fragment> component, but unfortunately at the time of this writing that isn't possible. This means I'm still stuck using a valid HTML element - hence the <span>.

See the Have Fragments support dangerouslySetInnerHTML on react's open issue

I'll keep an eye on the above issue, and if they ever add dangerouslySetInnerHTML support to Fragment I'll update on my end.

from react-localize-redux.

guicara avatar guicara commented on May 12, 2024

Hello,

Any update on this?
It will be really great to remove this <span>!

In the meantime, I override the initialize renderInnerHtml option for translation (set to false), then use ReactHtmlParser:

import ReactHtmlParser from 'react-html-parser';
const title = ReactHtmlParser(this.props.translate('title_with_html', null, { renderInnerHtml: false }));

from react-localize-redux.

ryandrewjohnson avatar ryandrewjohnson commented on May 12, 2024

I'd have a look at the convo happening in #134 as it's related to this. In terms of this issue though I believe the initial issue stands where a Fragment element doesn't support the dangerouslySetInnerHTML property

from react-localize-redux.

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.