All Projects → brainly → nodejs-onesky-utils

brainly / nodejs-onesky-utils

Licence: MIT license
Node.js utils for working with OneSky translation service.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to nodejs-onesky-utils

Electron Progressbar
electron-progressbar provides an easy-to-use and highly customizable API to show and control progress bars on Electron applications.
Stars: ✭ 58 (+81.25%)
Mutual labels:  nodejs-modules
Meetup Api
meetup-api is an Meetup.com API library written in JavaScript for Node.js V8 and Node.js ChakraCore
Stars: ✭ 104 (+225%)
Mutual labels:  nodejs-modules
Svg2vectordrawable
Node.js module and command-line tools for convert SVG to Android vector drawable.
Stars: ✭ 171 (+434.38%)
Mutual labels:  nodejs-modules
Node Ebml
EBML parser
Stars: ✭ 66 (+106.25%)
Mutual labels:  nodejs-modules
Leoric
👑 JavaScript ORM for MySQL, PostgreSQL, and SQLite.
Stars: ✭ 94 (+193.75%)
Mutual labels:  nodejs-modules
Tuya Mqtt
Nodejs-Script to combine tuyaapi and openhab via mqtt
Stars: ✭ 105 (+228.13%)
Mutual labels:  nodejs-modules
Catchart
Pipe something from command line to a chart in the browser
Stars: ✭ 27 (-15.62%)
Mutual labels:  nodejs-modules
Building Testable Apis With Nodejs
Repositório oficial do livro: Construindo APIs testáveis com Node.js
Stars: ✭ 227 (+609.38%)
Mutual labels:  nodejs-modules
Node Lei Stream
Read/Write stream line by line 按行读写流
Stars: ✭ 94 (+193.75%)
Mutual labels:  nodejs-modules
Inspirational Quotes
💡 A simple NPM Package which returns random Inspirational Quotes. Get your daily quote and stay motivated! ✌️ 🌸
Stars: ✭ 150 (+368.75%)
Mutual labels:  nodejs-modules
Awesome Npm Packages
🚀 A collection of awesome npm packages for Noders.
Stars: ✭ 69 (+115.63%)
Mutual labels:  nodejs-modules
Mastodon Api
Mastodon API Client Library
Stars: ✭ 89 (+178.13%)
Mutual labels:  nodejs-modules
Pm2 Slack
A PM2 module to emit events to Slack
Stars: ✭ 124 (+287.5%)
Mutual labels:  nodejs-modules
Trymodule
➰ It's never been easier to try nodejs modules!
Stars: ✭ 1,115 (+3384.38%)
Mutual labels:  nodejs-modules
Openwrt Node Packages
OpenWrt Project Node.js packages. v10.x LTS and v12.x LTS and v14.x LTS
Stars: ✭ 176 (+450%)
Mutual labels:  nodejs-modules
Nodemailer Examples
Nodemailer examples
Stars: ✭ 45 (+40.63%)
Mutual labels:  nodejs-modules
Json Node Normalizer
'json-node-normalizer' - NodeJS module that normalize json data types from json schema specifications.
Stars: ✭ 105 (+228.13%)
Mutual labels:  nodejs-modules
jackrabbit
Simple AMQP / RabbitMQ job queues for node based on amqplib
Stars: ✭ 28 (-12.5%)
Mutual labels:  nodejs-modules
Kute.js
KUTE.js is a JavaScript animation engine for modern browsers.
Stars: ✭ 2,270 (+6993.75%)
Mutual labels:  nodejs-modules
N26
💳 Un-official node.js module for interact with your N26 (previously Number26) account
Stars: ✭ 128 (+300%)
Mutual labels:  nodejs-modules

nodejs-onesky-utils Build Status Code Climate npm version

Node.js utils for working with OneSky translation service.

Install

$ npm i @brainly/onesky-utils

Example

getFile

var onesky = require('@brainly/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);
});

getFiles

var onesky = require('@brainly/onesky-utils');

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

onesky.getFiles(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);
});

postScreenshot

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

var options = {
  secret: '1234567',
  apiKey: 'abcdefg',
  projectId: '123',
  name: 'screenshot-name',
  image: 'base64-encoded-image',
  tags: [
    {
      key: 'translation-key',
      x: 100,
      y: 100,
      width: 100,
      height: 100,
      file: 'translations.po',
    },
  ],
};

onesky.postScreenshot(options).then(function(response) {
    console.log(response);
  }).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);
});

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

getFiles(options)

Returns every files' information via promise.

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

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

postScreenshot(options)

Uploads screenshot file to OneSky.

The options object is required. Options include:

  • options.projectId - Numerical ID of the project
  • options.secret - secret used for authentication
  • options.apiKey - apiKey used for authentication
  • options.name - A unique name to identify where the image located at your website, apps, blogs, etc... (Hints: path of the webpage)
  • options.image - Base64 encoded image data in Data URI scheme structure. Please reference to Data URI scheme and Base64
  • options.tags[] - Translations bind to the screenshot
  • options.tags[].key - Key of the translation
  • options.tags[].x - X-axis of the translation component
  • options.tags[].y - Y-axis of the translation component
  • options.tags[].width - Width of the translation component
  • options.tags[].height - Height of the translation component
  • options.tags[].file (Optional) - Name of the string file

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].