JavaScript translation libraries

Updated Nov 2026

JavaScript translation libraries convert text from one human language to another from Node.js, the browser, or React Native. A client sends each string to a hosted machine translation API and receives the translated text with its detected source language. These libraries let apps and AI agents serve content in a reader's own language.

Popularity

Google Cloud Translate has the most monthly downloads among dedicated translation clients in this comparison, at 2.8M.

LibraryMonthly downloadsStarsLast releaseLicense
@huggingface/transformers
19.1M
16.4KOct 2026Apache-2.0
@google-cloud/translate
2.8M
3.2KOct 2026Apache-2.0
@aws-sdk/client-translate
2.8M
3.7KNov 2026Apache-2.0
DeepL
1.9M
441Nov 2026MIT
@azure-rest/ai-translation-text
407.8K
2.3KMay 2026MIT
google-translate-api-x
322.1K
196May 2026MIT
bing-translate-api
188.3K
228Sep 2026MIT
Translate
58.7K
314Oct 2026MIT
Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

@huggingface/transformers

Runs Transformers machine learning models in the browser without a server.

Downloads / mo
19.1M
Stars
16.4K
Last release
4.3.2
License
Apache-2.0

Quickstart

From translation.d.ts
$ npm i @huggingface/transformers
import { pipeline } from '@huggingface/transformers';

const translator = await pipeline('translation', 'Xenova/nllb-200-distilled-600M');
const output = await translator('जीवन एक चॉकलेट बॉक्स की तरह है।', {
src_lang: 'hin_Deva', // Hindi
tgt_lang: 'fra_Latn', // French
});
// [{ translation_text: 'La vie est comme une boîte à chocolat.' }]

@huggingface/transformers examples

From open-source projects on GitHub

@google-cloud/translate

Provides Node.js clients for Google Cloud text and document translation.

Downloads / mo
2.8M
Stars
3.2K
Last release
10.3.0
License
Apache-2.0

Strengths

  • Translates formatted documents. Use the Advanced client for document translation.
  • Uses custom translation terminology. Apply a glossary to Advanced document translation.

Limitations

  • Mixed PDFs skip scanned content. Scanned content stays untranslated in PDFs containing both scanned and native text.
  • Requires a billed cloud project. Enable Cloud Translation and billing before authenticating the client.

Quickstart

From quickstart.js
$ npm install @google-cloud/translate
const {Translate} = require('@google-cloud/translate').v2;
const translate = new Translate({projectId: 'YOUR_PROJECT_ID'});

async function main() {
  const [translation] = await translate.translate('Hello, world!', 'ru');
  console.log(translation);
}
main();

@google-cloud/translate examples

From open-source projects on GitHub

@aws-sdk/client-translate

Provides the AWS Translate client for Node.js, browsers, and React Native.

Downloads / mo
2.8M
Stars
3.7K
Last release
3.1172.0
License
Apache-2.0
$ npm install @aws-sdk/client-translate
import { TranslateClient, TranslateTextCommand } from "@aws-sdk/client-translate";

const client = new TranslateClient({ region: "us-east-1" });
const result = await client.send(new TranslateTextCommand({
  Text: "Hello, world!",
  SourceLanguageCode: "en",
  TargetLanguageCode: "es",
}));
console.log(result.TranslatedText);

@aws-sdk/client-translate examples

From open-source projects on GitHub

Translates text and documents through the DeepL API.

Downloads / mo
1.9M
Stars
441
Last release
1.29.0
License
MIT

Strengths

  • Translates lists of text. Pass an array to translateText for multiple input strings.
  • Translates files through one helper. Use translateDocument with input and output paths or file handles.

Limitations

  • Glossaries cover selected language pairs. Check getGlossaryLanguagePairs before choosing a terminology pair.
  • Document waiting needs a timeout. Set timeoutMs to bound document translation waiting.

Quickstart

From README.md
$ npm install deepl-node
import * as deepl from "deepl-node";

const client = new deepl.DeepLClient(process.env.DEEPL_AUTH_KEY);
const result = await client.translateText("Hello, world!", null, "fr");
console.log(result.text);

@azure-rest/ai-translation-text

Provides an isomorphic client for the Azure Translator service.

Downloads / mo
407.8K
Stars
2.3K
Last release
2.0.0
License
MIT

Quickstart

From README.md
$ npm install @azure-rest/ai-translation-text
import TextTranslationClient, {isUnexpected} from "@azure-rest/ai-translation-text";
const client = TextTranslationClient(
  "https://api.cognitive.microsofttranslator.com",
  {key: "YOUR_SUBSCRIPTION_KEY", region: "westus"},
);
const response = await client.path("/translate").post({
  body: {inputs: [{
    text: "This is a test.",
    targets: [{language: "cs"}],
    language: "en",
  }]},
});
if (isUnexpected(response)) throw response.body.error;
console.log(response.body.value[0]?.translations[0]?.text);

google-translate-api-x

Provides free access to Google Translate.

Downloads / mo
322.1K
Stars
196
Last release
10.7.3
License
MIT

Quickstart

From README.md
$ npm install google-translate-api-x
import { translate } from 'google-translate-api-x';

const res = await translate('Ik spreek Engels', {to: 'en'});
console.log(res.text);

google-translate-api-x examples

From open-source projects on GitHub

bing-translate-api

Provides free access to Bing and Microsoft Translator from Node.js.

Downloads / mo
188.3K
Stars
228
Last release
4.3.0
License
MIT

Quickstart

From README.md
$ npm install bing-translate-api
const { translate } = require('bing-translate-api');

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

bing-translate-api examples

From open-source projects on GitHub

Uses a shared text-translation interface across several remote translation engines.

Downloads / mo
58.7K
Stars
314
Last release
3.1.1
License
MIT

Strengths

  • Switches between translation engines. Choose Google, Yandex, Libre, or DeepL behind the same interface.
  • Supports a self-hosted translation endpoint. Set url for a self-hosted LibreTranslate engine.

Limitations

  • Source language defaults to English. Set from when the input language differs.
  • Cached translations can outlive updates. Set cache duration when updated wording must replace cached results.

Quickstart

From readme.md
$ npm install translate
import translate from "translate";

translate.engine = "deepl";
translate.key = process.env.DEEPL_KEY;

const text = await translate("Hello world", "es");
console.log(text);
// "Hola mundo"

Translate examples

From open-source projects on GitHub

FAQ

Google Cloud Translate suits apps that need text and document translation on Google Cloud. DeepL suits apps that translate documents and want glossary support. Transformers.js suits apps that must translate on the device without a server.

Install @google-cloud/translate and create a client with a Google Cloud project's credentials. The client's translate method takes the text and a target language code.

The DeepL API is a paid machine translation service with a free tier. DeepL provides its official Node.js client for text and document translation.

DeepL supports fewer languages and adds glossaries and formality control. Google Cloud Translate covers more languages and supports custom models on Google Cloud.

google-translate-api-x and bing-translate-api call the free web translators without an API key. Both rely on unofficial endpoints that can change or rate-limit requests without notice.

The Azure Translator client is an isomorphic REST client for Node.js and the browser. It authenticates with an Azure resource key and region.

For coding agents

Found your translation library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official