A library for free and not only using various translation APIs, which supports working with JavaScript, TypeScript, and also has built-in separated types for Typebox.
Installation via Bun:
bun add @toil/translate
Installation via NPM:
npm install @toil/translate
To start working with the API, you need to create a Translation Client. This can be done using the code provided below.
const client = new TranslationClient({
service: TranslationService.yandexbrowser,
});
const translatedResult = await client.translate(
"The quick brown fox jumps over the lazy dog",
);
const detectResult = await client.detect(
"The quick brown fox jumps over the lazy dog",
);
const langs = await client.getLangs();
You can see more code examples here
Status | Service | Functions | Limits |
---|---|---|---|
✅ | YandexBrowser | Translate Detect GetLangs |
10k chars/req 10k chars/req |
✅ | YandexCloud | Translate Detect GetLangs |
2k chars/req 1k chars/req |
✅ | YandexTranslate | Translate Detect GetLangs |
10k chars/req 10k chars/req |
✅ | MSEdge | Translate Detect GetLangs |
50k chars/req 50k chars/req |
To build, you must have:
Don't forget to install the dependencies:
bun install
Building the entire package:
bun build:bun
You can use this build option if you only want to build types for TypeBox:
bun build:typebox
The library has minimal test coverage to check it's performance.
Run the tests:
bun test