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

bing-translate-api-module

v1.0.1

Published

[![NPM version](https://img.shields.io/npm/v/bing-translate-api.svg?style=flat)](https://www.npmjs.org/package/bing-translate-api) [![Auto Test](https://github.com/plainheart/bing-translate-api/actions/workflows/autotest.yml/badge.svg)](https://github.co

Downloads

3

Readme

bing-translate-api

NPM version Auto Test NPM Downloads License

A simple and free API for Bing Translator for Node.js.

Install

npm install bing-translate-api

Usage

From auto-detected language to English:

const { translate } = require('bing-translate-api');

translate('你好', null, 'en', true).then(res => {
  console.log(res.translation);
}).catch(err => {
  console.error(err);
});

Translation result

{
  "text": "你好",
  "userLang": "auto-detect",
  "translation": "Hello",
  // `correctedText` is returned only when `correct` is set as `true`
  // supported since v1.1.0
  "correctedText": "",
  "language": {
    "to": "en",
    "from": "zh-Hans",
    // supported since v1.1.0
    "score": 1
  }
}

API

translate(text, [from], [to], [correct], [raw], [userAgent], [proxyAgents])

text

Type: string

The text to be translated, can't be blank. The maximum text length is 1000.

from

Type: string Default: auto-detect

The language code of source text. MUST be auto-detect or one of the codes/names (not case sensitive) contained in lang.json

to

Type: string Default: en

The language in which the text should be translated. MUST be one of the codes/names (not case sensitive) contained in lang.json.

correct

Type: boolean Default: false Since: v1.1.0

Whether to correct the input text.

Note that:

  1. There is currently a limit of 50 characters for correction service.
  2. Only the languages in the list are supported to be corrected.
raw

Type: boolean Default: false

Whether the translation result contains raw response from Bing API.

userAgent

Type: string

The header value of user-agent used in API requests.

Default:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36
proxyAgents

Type: Got['Agents'] Default: undefined Since: v2.4.0

Set agents of got for proxy.

License

MIT © 2021-2022 plainheart.

Thanks

Great thanks to Bing Translator for providing so excellent translation service.