A simple web application that translates text from one language to another using a MongoDB database. This was built using the Google Translate API. Try it for yourself at https://translationmachine.onrender.com/ (may take a while to load).
- Node.js
- npm
- MongoDB
- Clone the repository:
git clone https://github.com/your-username/translation-application.git - Install dependencies:
npm install - Update the
.envfile in the root directory and add your MongoDB credentials:
MONGO_DB_USERNAME = "your-mongodb-username"
MONGO_DB_PASSWORD = "your-mongodb-password"
MONGO_DB_NAME = "your-mongodb-database-name"
MONGO_COLLECTION = "translations"
MONGO_CONNECTION_STRING = "your-mongodb-connection-string"
- Update the options in the
translationMachine.ejsfile in the root directory and add youX-RapidAPI-Keyfor Google Translate. You can obtain this at https://rapidapi.com/googlecloud/api/google-translate1
const options = {
method: 'POST',
url: 'https://google-translate1.p.rapidapi.com/language/translate/v2',
headers: {
'content-type': 'application/x-www-form-urlencoded',
'Accept-Encoding': 'application/gzip',
'X-RapidAPI-Key': 'ENTER_API_KEY_HERE',
'X-RapidAPI-Host': 'google-translate1.p.rapidapi.com'
},
data: encodedParams,
};
- Start the server:
node app.js - Open a web browser and navigate to
http://localhost:5000
- Select a language from the dropdown menus to specify the input and output.
- Enter text to translate in the input field.
- Click the "Translate" button to see the translation result.
This project is licensed under the MIT License. See LICENSE.md for details