Skip to content

maximromanyuk/react-native-translate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Native Translate

Usage

  1. yarn add react-native-translate
  2. Create json file with your translation like this:
{
  "email": "Електронна пошта"
}
  1. Set localization file in your index.js:
import ukTranslation from './src/localization/uk.json';
import { setLocalization } from 'react-native-translate';

setLocalization(ukTranslation);
  1. Use translation:
import { translate, Translate } from 'react-native-translate';

translate('email') // returns 'Електронна пошта'
// Or
<Translate value="email" /> // renders <Text>Електронна пошта</Text>
  1. If you want to run tests: npm test or npm run testonly or npm run test-watch.
  2. If you want to run linting: npm test or npm run lint. Fix bugs: npm run lint-fix.
  3. If you want to run transpilation to ES5 in dist folder: npm run prepublish (standard npm hook).

License

MIT