Hello everyone!! Today we will see how to create a multi language translation app. Through this app you can translate any text into more than 120 different languages. This is a very useful app, especially when you travel to different places and it is hard for you to adapt to the language of that region. I have added many more advanced features in this app as well, to make it much more interesting and make your translation work very easy. You can make the app speak the translated text. You can also use voice translation system. There are other basic options in the app as well, for example sharing your translated text, copying it or clear all your text etc. We will be using MIT App Inventor to create this app. It is quite easy to create this app and I will also share all the supporting links to help you as much as possible.
Resources
Visible Components used:
Vertical Scroll Arrangement
Text Box 1 (To enter normal text)
Table Arrangement
List picker (To select language)
1 button for text to speech
1 button to copy translated text
1 button to share translated text
1 button to clear all text
1 button for voice translation system
Text Box 2 (To display translated text)
Non Visible component used:
Yandex translate
Speech recognizer
Text to speech
Notifier
Sharing component
Clipboard extension
Source Code:
So first of all just set the elements of the list picker to the list of languages you want. Once the user clicks on translate option he/she has to choose their preferred language. Here I have shown an example with just three languages, but the .aia file that I have shared has more than 30 languages. So we will set the list picker elements to any languages we want.
Once the user chooses his preferred language we have to check, which language did the user choose. For example let us assume that the user chooses spanish, then we have to call the conditional if statement to check if the selected language is spanish or not. If the condition returns true then the app will request the yandex translate to translate the text into spanish else it will come out of that condition and check other statements in the code. To translate the text we have to enter the special code of the language. For instance: The code of spanish is es, Hindi is hi and so on. In the second option we have to select which is the text that we want to translate. In my case I am translating the text that the user has entered in the first text box.
After the yandex translate has translated the text successfully, we have to print that text into the second text box so that user can read that translated text.
If the user clicks on the copy button, we have to check if the text box 2 is empty or not. If it is empty then we have to call the notifier and warn the user that there is no translated text. If it finds something in the second text box then it will call clipboard extension and copy the translated text.
According to this code if someone clicks on the text to speech button then we will check if the second text box is empty or not. If it is empty then we have to show a warning message or else the app will speak the translated text.
Now if the user clicks on the share button then we will check if the second text box is empty or not. If it is empty then we have to show a warning message or else it will open the sharing option and you have to choose the medium through which you want to share it.
On pressing the clear button we will clear all the text from both the text box and we have to call notifier and tell the user that the text is cleared.
Let's see the voice translation code. If the user clicks on record button then we have to call speech recognizer to convert our voice to text.
After the speech recognizer converts our voice to text, we have to display the text or the result of the speech recognizer on the first text box.
This is the final code:
YouTube Video Tutorial:
Link to download files:
Comments