JavaScript

readme.md

Transifex-js-client

MIT License Build Status Coverage Status

Installation

  npm install or yarn

Documentation

You can find a jsDoc describing all commands and parameters of the client at http://transifex.github.io/transifex-js-client/

Example usage

NodeJS or bundling systems

npm install transifex-js-client or yarn add transifex-js-client # not yet applicable

And then inside your file you could do:

const TransifexApi = require('transifex-js-client');
const txApi = TransifexApi({
  username: 'tx_username',
  password: 'tx_password',
});
txApi.projects().then((data) => console.log(data.data))

Browser

To include transifex-js-client in a browser build you should use the transifex-api.min.js file found in the dist folder. You should also provide a promise polyfill if you plan on supporting older browsers.

var txApi = TransifexApi({
  username: 'tx_username',
  password: 'tx_password',
});
txApi.projects().then(function(data) { console.log(data.data); })

Running tests

In order to run the tests (which run through Karma) you need to expose credentials as environment variables. We do that with direnv. Create an .envrc containing:

export username=tx_username
export password=tx_password
export tx_host=https://www.transifex.com|http://tx.loc:8000
export COVERALLS_REPO_TOKEN=...

And then

direnv allow
npm test or yarn test

LICENSE

MIT