transifex-client
v0.0.1
Published
HTTP Client API for the Transifex translation service
Downloads
17
Readme
Transifex Client
A HTTP API client for the Transifex translation service.
var TransifexClient = require('transifex-client');
var transifex = new TransifexClient({
username: 'translator',
password: 'password'
});
transifex.projects.get({project: 'sample-project'}, function(err, data) {
console.log(data.description);
});
If no callback is provided, a readable stream is returned.
var translations = transifex.translations.get({
project: 'sample-project',
resource: 'sample',
language: 'es'
}, {
parse: false
});
translations
.pipe(fs.createWritableStream('./sample-project.es.json'));
Roadmap to 1.0
- [x] Request and handle gzip content
- [x] Support streaming responses
- [x] Implement methods for retrieving translations for a project
- [ ] Implement uploading new and updated resources
- [ ] Implement removing resources
- [ ] Implement languages
- [ ] Implement resource strings
- [ ] Implement statistics
- [ ] Create unit tests
- [ ] Setup Travis CI
- [ ] Should "get*" methods exist? If not, how should this API be organized?
- [ ] Finalize API
TransifexClient
- username
- password
TransifexClient.prototype.formats
get
transifex.formats.get(function(err, resp) {
console.log(resp.body.XLIFF)
});
TransifexClient.prototype.languages
get
transifex.languages.get(function(err, resp) {
console.log(resp.body[0].name);
});
getLanguage
- language
transifex.languages.getLanguage({language: 'pt_BR'}, function(err, resp) {
console.log(resp.body.name);
});
TransifexClient.prototype.projects
get
- project
transifex.projects.get({
project: 'sample-project',
query: {
details: true
}
}, function(err, resp) {
console.log(resp.body.description);
});
TransifexClient.prototype.resources
get
- project
transifex.resources.get({project: 'sample-project'}, function(err, resp) {
console.log(resp.body[0].slug);
});
getResource
- project
- resource
transifex.resources.getResource({
project: 'sample-project',
resource: 'sample',
query: {
details: true
}
}, function(err, resp) {
console.log(resp.body.wordcount);
});
TransifexClient.prototype.translations
get
- project
- resource (file)
- language
transifex.translations.get({
project: 'sample-project',
resource: 'sample',
language: 'es'
}, function(err, resp) {
console.log(resp.body);
});