IBM Watson Language Translator - eliranwong/UniqueBible GitHub Wiki
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
Check your 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:
- 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
- After registration, go to login page https://cloud.ibm.com/login to login into your IBM cloud account.
- Go to Menu > Resource list > Service > Language Translator (You may see screenshots we placed below.)
- Copy the values "API key" and "URL" for the next step
Enter your Credentials
Open a dialog window to enter your credentials via Focus menu layout > UniqueBible > Language Settings > Enter Credentials
After the dialog is opened, you can PASTE your API key and URL into corresponding fields. You can even edit "Version" if you use a different one.
Select "OK" after you enter 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
Config flag "autoCopyTranslateResult"
Config flag, 'autoCopyTranslateResult' is turned on for you by default. Therefore after a translation is done, you can paste the result whereever you like.
You can change this option via "Set Config flags" Window.
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).
-
Select a word or words on Main Window / Study Window
-
Right-click and select "Translate into [your_language]"
Note Editor
You can access Watson translator service from Text Utility toolbar on Note Editor.
-
Select a word / words
-
Select source language. Default source language is "Auto", which means automatically detects the language of selected text
-
Select target language.
-
Press the button "Translate into"