Skip to content

IBM Watson Language Translator

Eliran Wong edited this page Feb 25, 2021 · 11 revisions

IBM-Watson Language Translator

UniqueBible.app desktop version integrates IBM-Watson Language Translator service into right-click context menu, note editor and single-line command line. You need to install python package "ibm-watson" to use the service in UBA. If you have pip3 command in place, UBA automatically installs for you. To manually install, run the following command in terminal:

pip3 install ibm-watson

FREE to Use

IBM Cloud Lite account is FREE to use. IBM Cloud Lite account allows you translate "1,000,000 characters per month at no cost". You may find a registration link at: https://www.ibm.com/cloud/watson-language-translator/pricing

Enter Credentials

To use IBM-Watson with UBA, you need to enter your own credentials.

Remarks: UBA does NOT collect your credentials. Your credentials are stored on your local device only for communicating with IBM-Watson Language Translator service.

To enable IBM-Watson Language Trans:

  1. Register an IBM Cloud account (there are several types, the Lite one is FREE) You can find a registration link at https://www.ibm.com/cloud/watson-language-translator/pricing
  2. After registration, go to login page https://cloud.ibm.com/login to login into your IBM cloud account.
  3. Go to Menu > Resource list > Service > Language Translator (You may see screenshots we placed below.)
  4. Copy the "API key" and "URL"
  5. You are about to edit UBA file config.py, so make sure you are not running UBA while editing this file. Close UBA first if it is running.
  6. Use a simple text editor to open config.py
  7. Paste your apikey to INSIDE the pair of quotation marks of myIBMWatsonApikey = ''
  8. Paste your URL to INSIDE the pair of quotation marks of myIBMWatsonUrl = ''
  9. Save the file config.py
  10. Start UBA
  11. To test, run a command on main window command field, TRANSLATE:::en-zh:::testing
  12. Or, select a word from a bible chapter, right click and select "Translate into my language"
  13. Config flag, 'autoCopyTranslateResult' is turned on for you by default.
    Therefore after a translation is done, you can paste the result whereever you like.

Screenshot on locating your credentials

Select "Target Language for Translation"

To specify your preferred language for translation, on Focus menu layout, open language selection dialog from:

UniqueBible > Language Settings > Watson Translator > Target Language for Translation

Use Watson Translator service in UBA

Watson translator service is integrated in single-line command, right-click context menu, note editor.

Command keyword TRANSLATE:::

Usage - TRANSLATE:::[text to be translated]

Usage - TRANSLATE:::[source_language_code]-[target_language_code]:::[text to be translated]

You can skip specifying language codes. By doing this the app uses the "Target Language for Translation" you select (read description above)

TRANSLATE:::測試

TRANSLATE:::en-zh:::test

If you have config flag "autoCopyTranslationResult" enabled (it is enabled by default), translation result is automatically copy to clipboard so that you can paste where you like.

Right-click Context Menu

First, specify a target language for translation (read description above).

  1. Select a word or words on Main Window / Study Window

  2. Right-click and select "Translate into [your_language]"

Note Editor

You can access Watson translator service from Text Utility toolbar on Note Editor.

  1. Select a word / words

  2. Select source language. Default source language is "Auto", which means automatically detects the language of selected text

  3. Select target language.

  4. Press the button "Translate into"

Clone this wiki locally