react-intl-inject
react-intl helper, can translate props easily
Installation
Make sure react-intl is installed, it is required as a peer dependency
npm i react-intl
Then install as usual
npm i react-intl-inject
Usage
Suppose you need to translate a prop, for instance the value
of a submit button.
import React, { Component } from 'react'
import InjectIntl from 'react-intl-inject'
class MyComponent extends Component {
render () {
return (
<InjectIntl>
{({ intl }) => (
<button
type='submit'
value={intl.formatMessage({ id: 'enter.submit' })}
/>
)}
</InjectIntl>
)
}
}
See also this Stack Overflow question.