CombinedTranslate [BETA]
A package that has multiple translation API's and packages to return an assured response.
Install
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.
import translate from "combinedtranslate";
const translation = await translate("Hallo Wereld", { to: "English" });
Output
{
content: string,
pronunciation: string | null,
translated: boolean,
tries:number,
language: {
source: {
name: string | null,
code: string | null
},
target: {
name: string,
code: string
},
corrected: boolean,
certainty: number | null
},
text: {
input: string,
output: string,
corrected: boolean,
value: null
},
raw: {
}
}
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
import translate, {
languagesByCode,
languagesByName,
languageList,
} from "combinedtranslate";
languagesByCode;
languagesByName;
languagesList;
Notes
- Only compatible with ESM
- TypeScript and JavaScript support