npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@localize/node

v1.7.0

Published

Localize API for Node.js

Downloads

2,083

Readme

@localize/node

Wrapper for Localize public API's

Installation

Install via npm:

npm install @localize/node --save

Test command:

Checkout the project and in the root folder run 'npm run test'. Please note you will need to include a Localize API key and Localize project key in the 'test.js' file to run the test suite.

Initialize with your Localize API key

let localizeService = require('@localize/node')(key);

Endpoints

  • All callbacks are passed an error and response: callback(err, res).
  • Please refer to Localize's API Docs for the most up-to-date endpoint details.

localizeServices.project

localizeService.project.create({
        name: 'project1',
        sourceLanguage: 'en',
        type: 'file',
        activeLanguages: ['fr', 'zh'],
    }, callback);

Required fields:  name, sourceLanguage, type (defaults to 'web' if unspecified), activeLanguages

---

localizeService.project.getAll(callback);

---

localizeService.project.getOne({
        projectKey: <your projectkey>,
    }, callback);

Required fields:  projectKey    

---        

localizeServices.phrase

localizeService.phrase.create({
        projectKey: <your projectkey>,
        phrases: [{ 'phrase': 'phrase1', 'context': 'context1' }],
    }, callback):

Required fields:  projectKey, phrases   

---

localizeService.phrase.getAll({
        projectKey: <your projectkey>,
        limit: '2',
        state: 'pending',
        context: 'context',
    }, callback);

Required fields:  projectKey   

---

localizeService.phrase.update({
        projectKey: <your projectkey>,
        phrases: [{ 'phrase': 'phrase1', 'id': <phraseId>, 'context': 'context', 'labels': [] }]
    }, callback);

Required fields:  projectKey, phrases    

---

localizeService.phrase.deleteOne({
        projectKey: <your projectkey>,
        id: <phraseId>,
    }, callback);

Required fields:  projectKey, id        

---

localizeServices.labels

localizeService.label.create({
        projectKey: <your projectkey>,
        name: 'label1',
        description: 'test description',
        rules: ['autoapprove', 'neverdeprecate', 'excludeOrderTranslation', 'excludeMachineTranslation'],
        showInMenu: true,
    }, callback);

Required fields:  projectKey, name     

---

localizeService.label.getAll({
        projectKey: <your projectkey>,
    }, callback);

Required fields:  projectKey      

---

localizeService.label.getOne({
        projectKey: <your projectkey>,
        labelId: <labelId>,
    }, callback);

Required fields:  projectKey, labelId         

---

localizeService.label.update({
        projectKey: <your projectkey>,
        labelId: <labelId>,
        name: 'label1',
        description: 'test description',
        rules: ['autoapprove', 'neverdeprecate', 'excludeOrderTranslation', 'excludeMachineTranslation'],
        showInMenu: true,
    },
}, callback);

Required fields:  projectKey, labelId        

---

localizeService.label.deleteOne({
        projectKey: <your projectkey>,
        labelId: <labelId>,
    }, callback);

Required fields:  projectKey, labelId       

---

localizeServices.translation

localizeService.translation.create({
        phrase: <phraseId>,
        value: '#Hello, world!',
        state: 'active',
        language: 'fr',
        comment: 'testing',
        projectKey: <your projectkey>,
    }, callback);

Required fields: projectKey, value, state, language       

---

localizeService.translation.getAll({
        language: 'fr',
        projectKey: <your projectkey>,
    }, callback);

Required fields:  projectKey, language     

---

localizeService.translation.getOne({
        projectKey: <your projectkey>,
        translationId: <translationId>,
    }, callback);

Required fields: projectKey, translationId      

---

localizeService.translation.update({
        projectKey: <your projectkey>,
        translationId: <translationId>,
        state: 'active',
        comment: 'testing',
    },
}, callback);

Required fields:  projectKey, translationId         

---

localizeServices.content

localizeService.content.import({
        projectKey: <your projectkey>,
        language: 'fr',
        format: 'CSV',
        type: 'phrase',
        content: __dirname + '/to-translte.csv',
    }, callback);

Required fields: projectKey, language, format, type, content        

---

localizeService.content.export({
        projectKey: <your projectkey>,
        language: 'en',
        format: 'JSON',
        context: 'An active phrase context',
    }, callback);

Required fields: projectKey, language, format        

---

localizeServices.machine

localizeService.machine.translate({
        projectKey: <your projectkey>,
        phrase: 'This is a sample text',
        targetLanguage: 'fr',
        sourceLanguage: 'en',
    }, callback);

Required fields:  projectKey, phrase, targetLanguage        

---
localizeService.machine.detectLanguage({
        projectKey: <your projectkey>,
        phrase: 'Ceci est un exemple de texte',
    }, callback);

Required fields:  projectKey, phrase        

---

localizeService.machine.supportedLanguages({
        projectKey: <your projectkey>,
    }, callback);

Required fields:  projectKey      

---

localizeServices.getTeam

localizeService.getTeam({
        projectKey: <your projectkey>,
    }, callback);

Required fields:  projectKey       

---

localizeServices.languages

localizeService.languages({
        code: 'en',
    }, callback);

---

localizeServices.documents

localizeService.documents.createDocument({
    projectKey: <your projectkey>,
}, callback);

Required fields:  projectKey 

---

localizeService.documents.createTranslation({
    projectKey: <your projectkey>,
}, callback);

Required fields:  projectKey 

---

localizeService.documents.getDocuments({
    projectKey: <your projectkey>,
}, callback);

Required fields:  projectKey    

---

localizeService.documents.downloadDocument({
    projectKey: <your projectkey>,
    documentId: <your documentId>,
}, callback);

Required fields:  projectKey, documentId

---

localizeService.documents.downloadTranslation({
    projectKey: <your projectkey>,
    documentId: <your documentId>,
    language: 'fr',
}, callback);

Required fields:  projectKey, documentId, language

---

localizeService.documents.deleteOne({
    projectKey: <your projectkey>,
    documentId: <your documentId>,
}, callback);

Required fields:  projectKey, documentId   
  
---

Contribute

Forks and pull requests welcome!

Author

Supported and maintained by Localize.