@shamigondal/ai-translator
v1.0.6
Published
AI based Universal Language translator
Downloads
4
Readme
Introduction
A lightWeighted npm package for AI-based translation.
Usage
const { translator } = require('@shamigondal/ai-translator');
// Example usage
const textToTranslate = 'Hello, how are you?';
const targetLanguage = 'es'; // Replace with the target language code (e.g., 'es' for Spanish)
translator(textToTranslate, targetLanguage)
.then((translatedText) => {
console.log(`Original: ${textToTranslate}`);
console.log(`Translated: ${translatedText}`);
})
.catch((error) => {
console.error('Translation error:', error.message);
});
Features
- Light/dark mode toggle
- Live previews
- Fullscreen mode
- Cross platform
Deployment
To deploy this project run install node
npm i nodemon
.then type this command in command prompt
nodemon .\app.js
Documentation
Make sure to replace 'es' with the desired language code. You can find language codes in the ISO 639-1 standard.
translate(text, targetLanguage)
Translate the input text to the specified target language.
text (string): The text to be translated.
targetLanguage (string): The language code of the target language.
Returns a Promise that resolves to the translated text.