See the examples below, as well as Home.js and Carousel.js
All you need to do is to encode your component and open a PR. You should not see any changes at this step - please, check the text and links - everything should work as it was before. If so - open a PR, add a note that this PR is internationalisation of a component.
If you do not know, what to do - first, look at the examples below. If you still have troubles - add a code as the next example at the end of this page with the lines you need to encode (as is) and I will provide you the code (to be)
For each of your components you should do the following:
Step 1. Include the libraries:
...
Code Block | ||
---|---|---|
| ||
import {FormattedMessage, defineMessages} from 'react-intl'; |
Step 2. (If necessary) Include those to the end of the component, right before export default (see example 3 below): This is needed only if you use example 3 somewhere!
Code Block | ||||
---|---|---|---|---|
| ||||
Home<Component>.contextTypes = { //instead of Component - the name of your component, e.g. Home or Carousel intl: React.PropTypes.object.isRequired }; |
Step 3. Encode all strings to be collected for translation:
...