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 🙏

© 2026 – Pkg Stats / Ryan Hefner

yandex-translator

v1.0.1

Published

A promise based implementation of Yandex Translate API for Node.js.

Readme

yandex-translator

Introduction

yandex-translator is a a promise based implementation of Yandex Translate API for node.js

API key

To start using Yandex Translate API we need to get an API key first, which we will get it from the API key request form after having created an account the registration page.

Installation

npm install yandex-translator --save

Getting started

Import the yandex-translator package with with the API key obtained from the API key request form.

const yandexTranslator = require('yandex-translator')(apiKey);

Functions

yandexTranslator.getAvailableLanguages([parameters])

Get the languages that yandex-translator support their translation:

yandexTranslator.getAvailableLanguages().then(
    (result) => {
        console.log(result);
    },
    (error) => {
        console.log(error);
    }
);

The parameters parameter is an object which can contain any of the following attributes:

|Attribute | Type | Description |Default value | | ------------ | ------------ |------------ | ------------ | |[ui] | string | The returned language names are output in the language corresponding to the code in this parameter. The supported language codes are shown in the list of supported languages. | | |[resultFormat] | string | The result format which can be either JSON or XML. | JSON | |[apiKey] | string | Another API key to run only this request with |The same value as the initialized API key.

yandexTranslator.detectLanguage(parameters)

Detect a text language:

yandexTranslator.detectLanguage({text: 'Bonjour'}).then(
    (result) => {
        console.log(result);
    },
    (error) => {
        console.log(error);
    }
);

The parameters parameter is an object which can contain any of the following attributes:

|Attribute | Type | Description |Default value | | ------------ | ------------ |------------ | ------------ | |text* | string | The text that we want to detect it's language. | | |[hints] | array | An array of the most likely languages (they will be given preference when detecting the text language). | [] | |[resultFormat] | string | The result format which can be either JSON or XML. | JSON | |[apiKey] | string | Another API key to run only this request with |The same value as the initialized API key.

yandexTranslator.detectLanguage(parameters)

Translate a text:

yandexTranslator.translate({text: 'Bonjour', to: 'en'}).then(
    (result) => {
        console.log(result);
    },
    (error) => {
        console.log(error);
    }
);

The parameters parameter is an object which can contain any of the following attributes:

|Attribute | Type | Description |Default value | | ------------ | ------------ |------------ | ------------ | |text* | string | The text that we want to detect it's language. | | |to* | string | The language which the text will be translated to. | | |[from] | string | The source language of the text. If it's then the service will try to detect the source language automatically. | | |[options] | integer | Whether the response should include the automatically detected language of the text being translated: 1 to include the automatically detected language of the text, 0 to not | 1 | |[format] | string | The text format which can be plain (Text without markup) or html (Text in HTML format). | plain | |[hints] | array | An array of the most likely languages (they will be given preference when detecting the text language). | [] | |[resultFormat] | string | The result format which can be either JSON or XML. | JSON | |[apiKey] | string | Another API key to run only this request with |The same value as the initialized API key.

Task Lists

  • [ ] Add CLI support
  • [ ] Add browser integration
  • [ ] Create tests

License

MIT.