Code Monkey home page Code Monkey logo

node-onesky's Introduction

OneSky API for Node

This Node.js module provides access to the OneSky API for managing website translations.

Note: This module uses Onesky's "Classic API". Onesky has since released a new API called the Platform API. We should eventually migrate this module to the new API.

If you're looking for a service to order human translations, check out node-gengo.

Installation

Install via npm

npm install onesky --save

Usage

Initialize onesky with your public and private keys.

var onesky = require('onesky')(publicKey, privateKey);
Example calls

Note: All callbacks are passed an error and data argument: callback(err, data).

Create project with base locale en_US

onesky.project.add('My app', 'en_US', callback);

Fetch project

onesky.project.details('My app', callback);

Add a platform to a project

onesky.platform.add('My app', { type: 'website' }, callback);

Add a phrase to a platform. Strings parameter can be an object, array of objects, string, or an array of strings

var strings = [{
  string: 'My webapp is cool',
  stringKey: 'homepage.webapp_is_cool'
}, {
  string: 'Another sentence, without a stringKey'
}];

onesky.string.input(platformId, strings, callback);

Order translations

onesky.translate.order({
  platformId: platformId,
  agencyId: 5,
  toLocale: 'es_ES',
  filter: 'ALL'
}, callback);

Fetch translations

onesky.string.output({
  platformId: platformId,
  locale: 'es_ES'
}, callback);

For additional methods, see Onesky's documentation. All endpoints and options listed in the official API docs are available here.

Contribute

Forks and pull requests welcome!

TODO

  • Add tests
  • Parse OneSky's response when approriate. OneSky often returns unnecessary nesting
  • Design a better way of defining API keys to allow use of multiple onesky accounts

Author

Brandon Paton. Email me if you have any questions: [email protected]. Support by Localize.js.

node-onesky's People

Contributors

jkc avatar paton avatar pauliusuza avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.