Git Product home page Git Product logo

Comments (6)

jamuhl avatar jamuhl commented on May 17, 2024

You mean for the Interpolate Component?!? What you want to render? Could you paste some code snipplet?!?

from react-i18next.

peetzweg avatar peetzweg commented on May 17, 2024

I'am using a Component from the Material-UI framework, which receives a plain text as a secondaryText prop. Just dropping a Text with the Interpolate component with the default span parent breaks it's styling, the p element at least displays it in a block as it should be.

Using the HOC method to translate the text worked like charm before, however I switched to the Interpolate method because I had issues calculating the size of the Element the text is rendered into.

<ListItem
    secondaryText={
        <Interpolate 
            parent={'p'} 
            i18nKey={notification.message.content}
        />
    }
>

from react-i18next.

jamuhl avatar jamuhl commented on May 17, 2024

I'm rather sure we allow className on that: https://github.com/i18next/react-i18next/blob/master/src/interpolate.js#L47

think we should do the same for style prop?!? If you like you might add a PR for that to speed new version up...else i will add this asap (but not earlier ;))

from react-i18next.

peetzweg avatar peetzweg commented on May 17, 2024

Ah okay, with this i could create a workaround. However a style prop would be cleaner, at best the parent should be an actual component instead of a plain string.

from react-i18next.

jamuhl avatar jamuhl commented on May 17, 2024

You can pass your own component as parent - but obviously useless right now as no props get passed to it beside the className. For that we would need to remove all props that where used in for the interpolation and pass the rest of the props down to the parent component.

Should be possible...but like said...hard on time so don't expect this to land very soon. PR would be very welcome.

from react-i18next.

jamuhl avatar jamuhl commented on May 17, 2024

style prop will be passed to the interpolate container in next version

from react-i18next.

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.