Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yandex-cloud-translate

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yandex-cloud-translate

Translate text with Yandex Cloud AI API

  • 1.0.7
  • latest
  • Source
  • npm
  • Socket score

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

yandex-cloud-translate

Translate text with Yandex Cloud AI API

Features

  • ts included

Installation

Install my-project with npm

  npm i yandex-cloud-translate

or

  yarn add yandex-cloud-translate

Usage/Examples

import { Yandex } from 'yandex-cloud-translate';

const config = {
    YC_OAUTH_TOKEN = 'token', // https://cloud.yandex.com/en-ru/docs/iam/concepts/authorization/oauth-token
    YC_FOLDER_ID = 'folder_id' // https://cloud.yandex.com/en-ru/docs/resource-manager/operations/folder/get-id
}

const Ya = new Yandex(config);

or if you have valid process.env, just create in .env file YC_OAUTH_TOKEN and YC_FOLDER_ID

import { Yandex } from 'yandex-cloud-translate';
const Ya = new Yandex();
const translated = await Ya.translate({
    to: 'fr',
    from: 'en', // or don`t set to auto
    texts: ['text one', 'text two'], // or texts: 'text one'. string, or array of strings
    format: 'text', // or 'html'. default: 'text'
});

//
interface ITranslateConfig {
    texts: string | string[]; // if a string - result will be a string, if array of strings - array of strings
    to: string; // ISO ru, en, fr ... etc
    from?: string | null; // ISO ru, en, fr ... etc
    format?: 'text' | 'html';
}

Authors

  • @jsix

Keywords

FAQs

Package last updated on 10 Mar 2023

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