yarn add react-native-translate- Create
jsonfile with your translation like this:
{
"email": "Електронна пошта"
}- Set localization file in your
index.js:
import ukTranslation from './src/localization/uk.json';
import { setLocalization } from 'react-native-translate';
setLocalization(ukTranslation);- Use translation:
import { translate, Translate } from 'react-native-translate';
translate('email') // returns 'Електронна пошта'
// Or
<Translate value="email" /> // renders <Text>Електронна пошта</Text>- If you want to run tests:
npm testornpm run testonlyornpm run test-watch. - If you want to run linting:
npm testornpm run lint. Fix bugs:npm run lint-fix. - If you want to run transpilation to ES5 in
distfolder:npm run prepublish(standard npm hook).
MIT