https://github.com/thedummi/combinedtranslate
A package that uses multiple translate API's and packages just to get the best and most accurate results.
https://github.com/thedummi/combinedtranslate
free languages package translate
Last synced: 2 months ago
JSON representation
A package that uses multiple translate API's and packages just to get the best and most accurate results.
- Host: GitHub
- URL: https://github.com/thedummi/combinedtranslate
- Owner: TheDummi
- License: mit
- Created: 2022-12-20T12:28:50.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T12:09:19.000Z (about 1 year ago)
- Last Synced: 2025-02-14T00:47:44.144Z (4 months ago)
- Topics: free, languages, package, translate
- Language: TypeScript
- Homepage: https://dummi.me/packages
- Size: 37.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CombinedTranslate \[BETA\]
A package that has multiple translation API's and packages to return an assured response.
## Install
```md
npm i combinedtranslate
```**Note:** It will show a bunch of security issues, this has to do with packages using unmaintained versions of fetch API's, like got.
## How to Use
Using the package is very easy.
```js
import translate from "combinedtranslate";const translation = await translate("Hallo Wereld", { to: "English" });
// Output: translation.content = 'Hello World'
```### Output
```js
{
content: string, // The content of the translation
pronunciation: string | null, // If applied, it'll provide a phonetic script.
translated: boolean, // Whether it translated or not.
tries: number, // Number of times it switched API's to get the current response.
time: number // The amount of milliseconds it took to translate the given string.
language: {
source: { // The language translating from
name: string | null, // The name of the language (null when not provided.)
code: string | null // The ISO code of the language (null when not provided.)
},
target: { // The language you're translating to
name: string, // The name of the target language
code: string // The ISO code of the target language
},
corrected: boolean, // Whether autocorrect on language was used
certainty: number | null // The percentage of how certain the translator is (null when not provided)
},
text: {
input: string, // The string given on input
output: string, // The string returned as output or the content
corrected: boolean, // Whether autocorrect was used on the string
value: null // The corrected value.
},
raw: {
// The data without it being formatted nicely
}
}
```### Translate Options
| name | type | default | description |
| --------- | ------- | ------- | -------------------------------------- |
| to | string | English | language to translate to |
| from | string | null | language to translate from |
| logOnFail | boolean | false | Whether to log every time an API fails |### Methods
```js
import translate, {
languagesByCode,
languagesByName,
languageList,
} from "combinedtranslate";languagesByCode; // An object with all supported languages by their ISO code.
languagesByName; // An object with all supported languages by their name.
languagesList; // An array of all the languages just by name.
```## Notes
- Only compatible with ESM
- TypeScript and JavaScript support