martinandert / react-translate-component

A component for React that utilizes the Counterpart module to provide multi-lingual/localized text content.
MIT License
322 stars 31 forks source link

Translate without <span> tag #33

Closed athanph closed 6 years ago

athanph commented 6 years ago

Is there a way to translate without outputting the <span> tag wrapper? Anyway to configure this globally? Thanks.

martinandert commented 6 years ago

Not currently. But you can pass any component to Translate so it's not wrapped in a <span>.

So instead of

<p className="foo"><Translate ... /></p>

you can do

<Translate  ... component="p" className="foo" />

This also works for React classes:

<MyComponent some="prop"><Translate ... /></MyComponent>

becomes

<Translate ... component={MyComponent} some="prop" />