Translate text for free in the browser with iframe shenanigans
npm i iframe-translator
import { getClient, AvailableLanguages } from 'iframe-translator';
async function main() {
const client = await getClient();
console.log(AvailableLanguages); // { 'af': 'Afrikaans', ... }
console.log(await client.translate('こんにちは')); // hello
console.log(await client.translate('こんにちは', 'ko')); // 안녕하세요
client.destroy();
}
import type { AvailableLanguageCodes, IframeTranslatorClient } from 'iframe-translator';