bhashantarh
Version:
Tiny translation wrapper with fallbacks (LibreTranslate -> MyMemory) and detection with franc fallback.
53 lines (33 loc) โข 1.08 kB
Markdown
# ๐ bhashantarh
A simple, lightweight NPM package to detect and translate text between languages using [LibreTranslate](https://libretranslate.de/).
Perfect for use in **web apps, browser extensions, Node.js apps, and React projects**.
## โจ Features
- ๐ Detect the language of any input text
- ๐ Translate between supported languages
- ๐ง Uses free public translation API (LibreTranslate)
- โก Easy to integrate in any project
## ๐ฆ Installation
```bash
npm install bhashantarh
```
## ๐ Usage
```js
const { detectLanguage, translate, getSupportedLanguages } = require("bhashantarh");
(async () => {
const lang = await detectLanguage("Bonjour");
console.log("Detected:", lang); // fr
const output = await translate("Hello", "en", "hi");
console.log("Translated:", output); // เคจเคฎเคธเฅเคคเฅ
console.log(getSupportedLanguages());
})();
```
## ๐ Supported Languages
Includes major global languages like:
- English, Hindi, Urdu, Arabic, Chinese, Russian, Tamil, Telugu, etc.
## ๐ License
MIT License