poeditor-utils
high-level POEditor API utilities for Node.js
var utils = require('poeditor-utils');
utils.getProject(apiToken, projectName)
apiToken
String
POEditor API tokenprojectName
String
POEditor project name
Returns a promise which resolves with a poeditor-client Project
representation of the project. See the docs there for more.
utils.getProject('my token', 'my project')
.then(function (project) {
console.log(project);
});
utils.pullTranslations(apiToken, projectName, getPathCallback)
apiToken
String
POEditor API tokenprojectName
String
POEditor project namegetPathCallback(translation)
Function
produces destination file path for given translation
translation
Object
translation of a single term to a single language
translation.term
String
translation.language
String
translation.value
String
Gets translations for all the project languages and writes them to files as produced by getPathCallback
as a stable sorted JSON. Returns a promise which resolves with an Iterable
of output files.
utils.pullTranslations('my token', 'my project', function (translation) {
console.log(translation);
return 'my-translations/' + translation.language + '.json';
})
.then(function (files) {
console.log(files);
});
utils.Client
Exposes the poeditor-client Client
for practicality. See the docs there for more.
new utils.Client(apiToken)
apiToken
: POEditor API token
var client = new utils.Client('my token');