Localisation
March 8, 2018 · View on GitHub
The IOTA community is very large and diverse. In order to achieve widespread adoption, it is important that users can use IOTA in their native language. The i18next and react-i18next libraries are used to make localisation easier.
If you are making a contribution that includes adding or changing text, please follow the instructions for localisation.
Instructions
- Import the
translatehigher order component (HOC)
import { translate } from ‘react-i18next’;
- Set a constant
tequal to the props
const { t } = this.props;
- Tell i18next to get the translations for your keys (please name the key appropriately)
<Text>Hello world!</Text>
changes to
<Text>{t(‘helloWorld’)}</Text>
- Wrap the component
export translate(‘myContainer’)(MyContainer);
- Update the JSON (located in
src/shared/locales/en/translation.json) accordingly
“myContainer”:{
“helloWorld”: “Hello world!”
}
You're all done! Your strings will be shown on Crowdin once your merge request has been merged into the develop branch.