New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

onesky-utils

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onesky-utils

Node.js utils for working with OneSky translation service.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
691
decreased by-2.12%
Maintainers
1
Weekly downloads
 
Created
Source

nodejs-onesky-utils Build Status Code Climate npm version

Node.js utils for working with OneSky translation service.

Example

getFile

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);
});

getMultilingualFile

var onesky = require('onesky-utils');

var options = {
  language: 'en_EN',
  secret: '1234567',
  apiKey: 'abcdefg',
  projectId: '123',
  fileName: 'translations.po',
  format: 'I18NEXT_MULTILINGUAL_JSON'
};

onesky.getMultilingualFile(options).then(function(content) {
  console.log(content);
}).catch(function(error) {
  console.log(error);
});

postFile

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);
});

getLanguages

var onesky = require('onesky-utils');

var options = {
  apiKey: 'abcdefg',
  secret: '1234567',
  projectId: '123'
};

onesky.getLanguages(options).then(function(content) {
  console.log(content);
}).catch(function(error) {
  console.log(error);
});

Install

$ npm install onesky-utils

API

getFile(options)

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

getMultilingualFile(options)

Downloads multi-language translations 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.format - Response file format (Optional. Defaults to I18NEXT_MULTILINGUAL_JSON)
  • options.language - Language version
  • options.secret - secret and apiKey are used for authentication
  • options.apiKey

postFile(options)

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.allowSameAsOriginal Keep the translations that are the same as source text (Optional. Defaults to false)
  • 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
        }
    ]
}

getLanguages(options)

Get list of project languages.

The options object is required. Options include:

  • options.projectId - Numerical ID of the project
  • options.secret - secret and apiKey are used for authentication
  • options.apiKey

Returns JSON API response content via promise. Example:

{
    "meta": {
        "status": 200,
        "record_count": 2
    },
    "data": [
        {
            "code": "en-US",
            "english_name": "English (United States)",
            "local_name": "English (United States)",
            "locale": "en",
            "region": "US",
            "is_base_language": true,
            "is_ready_to_publish": true,
            "translation_progress": "100%",
            "uploaded_at": "2013-10-07T15:27:10+0000",
            "uploaded_at_timestamp": 1381159630
        },
        {
            "code": "ja-JP",
            "english_name": "Japanese",
            "local_name": "日本語",
            "locale": "ja",
            "region": "JP",
            "is_base_language": false,
            "is_ready_to_publish": true,
            "translation_progress": "98%",
            "uploaded_at": "2013-10-07T15:27:10+0000",
            "uploaded_at_timestamp": 1381159630
        }
    ]
}

Tests

$ npm test

License

MIT

FAQs

Package last updated on 30 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc