Skip to content

Simple API wrapper for LibreTranslate, an open-source alternative to Google Translate, also supports self-hosted versions

License

Notifications You must be signed in to change notification settings

tltsutltsu/libretranslate-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LibreTranslate (NPM)

Original API

Simple API wrapper for LibreTranslate, an open-source alternative to Google Translate, also supports self-hosted versions

Installation

Node.js v17.5.0 or newer with fetch is required.

# NPM
npm install libretranslate

# Yarn
yarn add libretranslate

Usage

// CommonJS
const { translate } = require('libretranslate');

// ES Modules (ESM) or Typescript
import { translate } from 'libretranslate';

Using translate() function.

await translate({
  query: 'text', // Text to be translated.
  source: 'lang', // The original language. (auto by default)
  target: 'lang', // The language to translate.
  format: 'text', // The format of the translated text (HTML or Text) Optional
  apiurl: 'URL', // Custom API url, if self-hosted
  apikey: 'key', // API Key
});

About

Simple API wrapper for LibreTranslate, an open-source alternative to Google Translate, also supports self-hosted versions

Resources

License

Stars

Watchers

Forks

Packages