yarn add react-native-translate
- Create
json
file 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 test
ornpm run testonly
ornpm run test-watch
. - If you want to run linting:
npm test
ornpm run lint
. Fix bugs:npm run lint-fix
. - If you want to run transpilation to ES5 in
dist
folder:npm run prepublish
(standard npm hook).
MIT