translator web app using HTML,CSS and JAVASCRIPT

translator web app using HTML,CSS and JAVASCRIPT:

 There are three things that are needed for an application-input,processing and output.For processing in this app means translation.We will be using funtranslation api which returns translated content.

Funtranslations API

There are so many translation languages available which can be used for translations.Here we will be using minion language and to get response from the api we need to send the url in the given format-

Taking User Input

For any translator app, the first thing needed is the user’s input so we that using textarea tag of HTML.

Processing User Input

For processing which is done in our app.js, we reference textarea in javascript using document.querySelector()

Now we have reference to input and to extract the value from this we will use textInp.value.But first, we will make a function to get our translation url which we will be using it to fetch translated text from the server using the funtranslations api 

Here serverUrl is the base url which is required for API. Now a fetch function which gets the translated text and displays output using innerText on an output element also referenced using document.querySelector()

Translated Output To The User

We will create a div that has no text and will show output after processing after clicking of a button happens.

Button referenced in the script and added an event listener addEventListener()on it which waits for a click on the button and then calls our clickHandlerfunction.

from Tumblr

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s