Mercury: Translations to English

Translate a word, listen to its pronunciation, see example sentences


Mercury is a web app that uses the Oxford Dictionaries to show you translations of a word that you specify. It also gives you a sound file that you can play to listen to the pronunciation of the English word. Further, Mercury also gives you some example sentences with the English word, so that you can see how to use the word in English sentences.

To use Mercury, you need API keys from Oxford Dictionaries API and an internet connection. After you've obtained the API keys, you can install Mercury and use it. You don't need any programming knowledge to either install or use Mercury.

Demo



Installing Mercury

To use Mercury, you need Python. Mercury uses Python 3.7. If you already have Python 3.7 on your computer, jump to step B.7. If you don't, begin with step A.1.

A. Installing Python and an integrated development environment

  1. Go to https://www.python.org/downloads/.
  2. In the Looking for a specific release section, locate the latest version of Python 3.7. This version will have a name like Python 3.7.5 or 3.7.7. Click the version.
  3. Take a minute to read the information on the page. Then, click the installer for your operating system, save the file on your computer, run the file, and follow the on-screen instructions. Make a note of the directory where Python is being installed; you'll need this location in a later step.
  4. After Python in installed, download a development environment by going to https://www.jetbrains.com/pycharm/download/#section=windows. Click the operating system you use, and click the Download button in the Community section.
  5. Run the downloaded file and follow the on-screen instructions.

After Python 3.7 and JetBrains PyCharm Community Edition are installed, you are ready to install Mercury.

B. Installing Mercury

  1. Start JetBrains PyCharms and click Create New Project.
  2. In the Location field, specify the directory where the Mercury files are to be stored. Make a note of this location because you will need it in a later step.
  3. Expand the Project Interpreter section by clicking the arrow next to it. Select the New environment using option and, from the list, select Pipenv.
    user interface for creating a project in JetBrains
  4. For the Basic interpreter field, browse to the location where you installed Python, and select the python.exe file in that directory. If you just installed Python, this is the location you made a note of in step A.3.
  5. For the Pipenv executable field, browse to the location where you installed Python, go to the Scripts directory, and select the pipenv.exe file.
  6. Click Create. A project is created, and opened for you to work in.
  7. Open an browser and go to GitHub URL. Click the arrow next to the Clone or download button and save the .zip file on your computer.
  8. Open file explorer, and extract the contents of the .zip file. Select all of the extracted files, and press CTRL+C.
  9. In file explorer, go to the directory for the Mercury files. This is the location you specified in step B.2. Press CTRL+V. If you get a message for overwriting any files, overwrite them.
  10. Return to the JetBrains PyCharm interface. You'll notice that the Project tree on the left now has all the files that you copied over in the previous step.
  11. Open the static > config.json file. Replace the three dots for app_id and app_key with your Oxford API credentials. Replace the three dots for source_language with the code for the language for which you need English translations (see language codes). Save the config.json file.
  12. Right-click the mercury.py file and click Run 'mercury'. A console opens at the bottom of the screen and you should see something similar to this image.

    This means the Mercury installation was successful.
  13. On the console, click http://127.0.0.1:5000/. A browser page opens to show the Mercury interface.
  14. Return to JetBrains Pycharm. Stop Mercury by clicking the red square in the leftmost section of the console.

C. Customising Mercury (Optional)

The user interface of Mercury is in English. You can change the text to your language.

  1. Open the static > interface.json file. You see the words and sentences that are used for the Mercury interface. Replace these with your own. Be careful about not changing anything to the left of the colon (:). You can change the text to the right of the colon. Also be careful about not deleting any commas (,), quotation marks ("), or braces ({ and }).
  2. Run Mercury and go to http://127.0.0.1:5000/. You should see your own text now. Return to JetBrains Pycharm and stop Mercury.

Using Mercury

  1. Open a browser and go to http://127.0.0.1:5000/.
  2. Enter the word to be translated. Make sure you use the native language script for entering the word. For example, if you are translating from Urdu, enter ترجمہ in the Nastalikh script instead of entering the English transliterated tarjuma in the Roman script.
  3. Click Translate. You are taken to the page that shows you the translations and example sentences. If the translated word has a pronunciation guide, the sound file is also included for you to listen to.