Any person who is interested in making money online will no doubt have come across translating as a way to earn a part time or full time income. I undertook a quick search of the internet and found the website, Moneybies, which devoted an entire page to earning money translating. The link to the site can be found here:- Make money with Translation | 6 Best Online translation Jobs Websites (moneybies.com)
My partner has a fascination with languages and has studied Spanish, Swedish, and Danish. He speaks to people in these languages as often as he can, so would make a great candidate to work as an online translate, should he be motivated to do so.
I was inspired to program an online translate for those individuals who would like to earn an income translating. The secret ingredient to this program is the python library, translate. I found this library quite easy to program and prefer it to its rival, Google Translate (although I might write a program using this library at some point in the future).
I wrote the program in one cell of Google Colab, an online Jupyter Notebook that has Python already installed on it. Because translate was not installed on Google Colab, I installed it using the below statement:-
Once translate had been installed, I needed to import the libraries that would be needed to execute the code. The libraries I imported were translate, pandas and datetime:-
I decided that in order for a person to be able to make money working as an online translate any work would need to be saved. I therefore created an empty dataframe with three columns. The three columns in this empty dataframe are translation_no, text, and translation.
I defined a variable, trans_from, where the user is asked to enter the language he would like to translate from.
I defined a second variable, trans_to, where the user is asked to enter the language he would like the text to be translated to.
I then defined the variable, translate, which is based on the function Translate and uses the variables trans_from and trans_to.
I defined two more variables, which would be necessary during the execution of the program. The variable, again, was set to ‘y’, which would be used during the execution of the program. The variable, count, would be used as a counter to keep track of all of the statements that will be translated as the while loop in the program runs:-
The while loop forms the body of the program and will operate as long as again equals ‘y’.
The variable translate_please is used to prompt the user to enter the text he would like to translate.
The translate function is called and the data in translate_please is used as the input to this function. The text the user entered, which resides in translate_please, is printed out. The translation, which resides in the variable, translation, is printed out in the next line. The counter is then incremented by one digit.
The three pieces of information: count, translate_please, and translation are appended to the empty dataframe that had been created at the beginning of the program.
Once the dataframe has been appended with the counter, the data the user entered, and it’s translation, the user is asked if he would like to translate another line of text. If the user enters ‘y’ then the while loop will carry out another sequence and continue to do so until the variable, again, is no longer ‘y’. Once the user enters ’n’, the while loop will stop:-
Once the while loop has stopped translating text, the next lines of code have been created to take the dataframe that had been prepared and convert it to a .csv file.
The variable, now, was defined to use the date and time as the filename that will be created. The variable, now, is then converted to a string.
The dataframe is then converted to a .csv file and the string value that had been created from the date and time will be used as the basis of the actual file name. This .csv file will be saved in the Google Colab directory and it can be accessed and used for future reference.
Finally, a variable, translation_file, is created and printed out so the user can have a record of the translations the program has made:-
The screenshot below is a recording of the text the user has entered and its corresponding translation:-
The screenshot below shows where the actual .csv file is stored in Google Colab. As can be seen, I tested the program several times to ensure it was accurate:-
The .csv file the user wants to access can be downloaded into the computer’s download directory. When the user double clicks on the file, it will open up into an Excel spreadsheet with each translation taking up one row of the spreadsheet:-
If anyone decides to use this program as a translate and earns an income from it, please let me know about it. As I progress in my knowledge and understanding of Python, I may develop it into an application or an online program. In the meantime, feel free to use my work.