bhashantarh
Version:
Tiny translation wrapper with fallbacks (LibreTranslate -> MyMemory) and detection with franc fallback.
21 lines (15 loc) • 942 B
JavaScript
const { detectLanguage, translate, getSupportedLanguages } = require('./index');
(async () => {
console.log('--- Detection tests ---');
const d1 = await detectLanguage('Hola amigo');
console.log('Detected (Hola amigo):', d1);
const d2 = await detectLanguage('यह एक परीक्षण वाक्य है');
console.log('Detected (Hindi sample):', d2);
console.log('\n--- Translation tests ---');
const t1 = await translate('Hey there! I’m Hrishikesh — a curious coder who loves building cool stuff with JavaScript & AI. From full-stack apps to smart tech, I turn ideas into interactive reality! Let’s build, break, and make magic on the web.?', 'en', 'hi');
console.log('EN -> HI:', t1);
const t2 = await translate('Bonjour tout le monde', 'fr', 'en');
console.log('FR -> EN:', t2);
console.log('\n--- Supported Languages ---');
console.log(getSupportedLanguages());
})();