# How To Use [React-Intl](https://github.com/yahoo/react-intl): internationalize your React app
> This short tutorial assumes you know about ES6 syntax.
## Get started
`yarn add react-intl` or `npm i --save react-intl`.
## Create a messages file
This file should contain every message for your app.
It has an **object** of **(locale, messages)** couples:
```javascript
export default {
'en-GB': {
// We're using dots for nesting and camelCase for each name
'homepage.welcome': 'Welcome!',
'homepage.subscribeHeader': 'Subscribe Now',
// You can use placeholders using curly braces ({variable})
'user.hello': 'Hi {username}, how are you?',
// ...and also HTML
'user.signIn': 'Please, sign in'
},
'fr-FR': {
'homepage.welcome': 'Bienvenue !',
'homepage.subscribeHeader': 'Abonnez-vous',
'user.hello': 'Bonjour {username}, comment ça va ?',
'user.signIn': 'Veuillez vous connecter s\'il vous plaît'
}
};
```
Each message should be associated to a unique ID that will be required later (e.g. `homepage.welcome`).
*We'll now assume that these messages are stored in a `messages.js` file.*
## Import messages
At the **root of your app**, import your messages file:
```javascript
import messages from './messages';
```
## Import languages for `react-intl`
For **each language you're using in your application**, you'll need one additional line on your same **app index file**:
```javascript
// If we're using English and French ('en', 'fr')
import en from 'react-intl/locale-data/en';
import fr from 'react-intl/locale-data/fr';
// But if you need Spanish for example, you'd then need to import
import es from 'react-intl/locale-data/es';
```
And then tell `react-intl` to use them (we'll import `addLocaleData` right after):
```javascript
addLocaleData([...en, ...fr]);
```
## Wrap this up
It's now time to provide the messages to all our components.
Here, we'll need both `IntlProvider` and `addLocaleData` (from the previous step):
```javascript
// Paste this before the previous imports
import { addLocaleData, IntlProvider } from 'react-intl';
```
Look up for the user's locale:
```javascript
const locale = (navigator.languages && navigator.languages[0])
|| navigator.language
|| navigator.userLanguage
|| 'en-US';
```
And add the provider to your app:
```jsx
ReactDOM.render((