Node.js utils for working with OneSky translation service.
var onesky = require('onesky-utils');
var options = {
language: 'en_EN',
secret: '1234567',
apiKey: 'abcdefg',
projectId: '123',
fileName: 'translations.po'
};
onesky.getFile(options).then(function(content) {
console.log(content);
}).catch(function(error) {
console.log(error);
});
var onesky = require('onesky-utils');
var options = {
language: 'en-US',
secret: '1234567',
apiKey: 'abcdefg',
projectId: '123',
fileName: 'translations.json',
format: 'HIERARCHICAL_JSON',
content: JSON.stringify(translations),
keepStrings: true
};
onesky.postFile(options).then(function(content) {
console.log(content);
}).catch(function(error) {
console.log(error);
});
$ npm install onesky-utils
Downloads translation file from OneSky.
Returns file content via promise.
The options
object is required. Options include:
- options.projectId - numerical ID of the project
- options.fileName - name of the translation file
- options.language - language version
- options.secret - secret and apiKey are used for authentication
- options.apiKey
Uploads translation file to OneSky.
The options
object is required. Options include:
- options.projectId - numerical ID of the project
- options.fileName - name of the translation file
- options.language - language version
- options.format - file format (list here)
- options.content string with the content of the file
- options.keepStrings boolean saying if already uploaded strings not present on this file should be deprecated or keept
- options.secret - secret and apiKey are used for authentication
- options.apiKey
Returns JSON API response content via promise. Example:
{
"meta": {
"status": 200,
"record_count": 16
},
"data": [
{
"name": "translations.json",
"string_count": 236,
"last_import": {
"id": 123,
"status": "in-progress"
},
"uploaded_at": "2013-10-07T15:27:10+0000",
"uploaded_at_timestamp": 1381159630
}
]
}
$ npm test