Code Monkey home page Code Monkey logo

text-translator's Introduction

Text Translation Application

It is a Web Application which translate text from one language to another.
Deployed Link: https://text-translator.cyclic.app/

Tools/Technologies Used

  • HTML
  • CSS
  • Bootstrap
  • JavaScript
  • jQuery
  • Node.js
  • Express.js
  • EJS
  • IBM Watson Language Translator API
  • MySQL Database
  • Jest & SuperTest (for testing of application)

Installation

This application can easily be installed in three steps:

Step 1: Open index.js file and insert your 'IBM-Watson Language Translator' api key and service URL at appropriate positions in the code.

Step 2: Set Up MySQL database, server and Workbench locally and insert your Database credentials at proper position in the index.js file.

Step 3: Create a MySQL table inside your database using MySQL Workbench. Please refer to 'MySQL Database Schema' folder provided in this repository for database Schema. The Database consists of four columns namely 'from', 'inputText', 'to', and 'outputText' which represents 'source language', 'text to be translated' , 'target language', and 'translated text' respectively.

Usage

In your console run this command:

node ./index.js

This will start the node.js server locally in your machine. Now, open a web browser and visit:

http://localhost:3000/

Note that it is 'http' and not 'https'. Make sure you are connected to the Internet.

Working/Logic

This application consists of two GET routes namely "/" and "/query". In the root route i.e. ("/") Front.ejs file is rendered, this file includes a form with a textbox, two option buttons (for selecting source and target language), and a submit button (Translate button). When a user enters some text, selects source and target language and hits Translate button a GET request is made to "/query" route along with input parameters.

In the "/query" route an API call is made to 'IBM-Watson Language Translator' along with input parameters. The 'IBM-Watson Language Translator' receives these input parameters and sends a JSON object as a response. Now the translated text is extracted from this JSON object and is passed to result.ejs file. This file is then rendered and translated text appears.

Now in the same route a SQL query is made which takes these input parameters along with translated text and saves all of them into a MySQL table.

Further Improvements

It would be a great Idea to search the Database for translated text first using the input parameters instead of making an API call every time the user hits translate button. If the Database doesn't includes translated text for a given set of input parameters only then an API call should be made. Overtime, as our database increases in size less and less API calls will be made.

In total 'IBM-Watson Language Translator' supports 62 languages which means more languages can be added to this application as per the requirement.

text-translator's People

Contributors

rajatsachan37 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.