lingator
v1.0.3
Published
A plug-and-play npm package to auto-translate webpages using Google's Gemini AI.
Maintainers
Readme
🌐 Lingator
A lightweight and powerful translation library to add multilingual support to your website or app with just a few lines of code.
🚀 Features
- 🌍 Supports multiple languages (English, Hindi, Marathi, French, German, etc.)
- ⚡ Lightweight and simple setup
- 🧩 Easy integration with existing websites and apps
- 🔥 Dynamic language switching with buttons
📦 Installation
Install the package via npm:
npm install lingator⚙️ Setup Instructions (React)
1. Import Lingator
import { initLingo, translatePage } from 'lingator';2. Initialize Lingator
initLingo({
defaultLang: 'en',
supportedLangs: ['en', 'es', 'fr', 'hi'],
});3. Translate Your Page
translatePage('es'); // Example: Translate to Spanish🖥️ Example React Component
import { useEffect } from "react";
import { initLingo, translatePage } from 'lingator';
function App() {
useEffect(() => {
initLingo(['en', 'hi', 'mr', 'fr', 'de']); // Find Language Codes Online
}, []);
return (
<div>
<h1>Hello World</h1>
<p>This is a test page for Lingo.</p>
<div>
<button
onClick={() => translatePage("hi")}
>
Hindi
</button>
<button
onClick={() => translatePage("mr")}
>
Marathi
</button>
<button
onClick={() => translatePage("fr")}
>
French
</button>
<button
onClick={() => translatePage("de")}
>
German
</button>
<button onClick={() => translatePage("en")}>English</button>
</div>
</div>
);
}
export default App;
