gTranslator

gTranslator.lha (MorphOS) Readme History
This sbar module allows you to use the google translator from your screenbar!

Just click on the Google-Translator symbol in the screenbar, a window will be opened where you can write the word or sentence you want to translate into the first or second string gadget. The text will be instantly translated while you are typing!

There are also two custom popup gadgets to choose the source and translated language.
Its now possible to open the translator window by pressing the hotkey alt-#.
It can be customized in the settings.

You can use the gTranslator from any programm which supports Copy&Paste!
Just activate the clipboard hook (press the right mouse button over the gTranslator icon in the screenbar) then everything which is copied to the clipboard will be translated and displayed in a help bubble at the mouse pointer's position!
You can also automatically insert the translated text in your application, by pressing the Cut&Traste hotkey (default right amiga-shift-x) after marking a text.

History:
03-Jan-2021: v3.6, release
Fix: Recompiled with a new ECX library module code, which fixes a use-after-free bug
28-Dez-2017: v3.5beta
Fix: Recompiled with the fix in ECX's library generation code, which causes a crash if my sbar fails to open on first opening (did the fix already in Nov-2016, but didn't recompiled gTranslator.sbar) Fix: Seems so that with current betas (don't know since when exactly) Scintilla.mcc has problems with setting SCI_ActiveEditor to FALSE, so I just set the right scintilla object to MTRUE
14-Sep-2016:
Fix: Clicking on "Visit homepage" in the UpdateCheck requester, gives hits, because I used SystemTagList() with Sys_Asynch,TRUE but without specifying SYS_Input/SYS_Output, shame on me;)
08-Nov-15:
Chg: The "Failed to retriev data!" msg now shows an error string for ErrCode (localized) and ResponseCode.
??-Sep-15:
Chg: To workaround a bug, that the screenbar freezes when you select a menu entry, I added the envvar gTranslatorMenuFreeze, set it to some value, then gTranslator inactivates its window and immediately activates it again

What has changed in v3.4:

Fix: The error bubble also appeared if you use Cut'&'Traste
Chg: Changed the menu-hotkey to en/disable the clipboard to rAmiga-h, cause it collides with Scintillas copy-clipboard-hotkey
Although my menu-hotkey was rAmiga-SHIFT-c but it seems, that intuition only supports uppercase chars if you also the define a menuitem with the char in lowercase!
New: Added a shorthelp to the lamp object
New: If the bubble with the translated string couldn't be created (f.e. the str was too long), an error bubble appears
Fix: If you delete the last char in the source field, the last char in the target field stays there
Fix: Finding the source lang was broken, due to latest changing, thats why retranslating wasn't done, if you have "source lang" set to "auto" and you copied a text in your destination language, which should have been retranslating to you home language
New: Linefeeds in the translated text will be replaced by a space, this looks better in the bubble, so MUI formats the text on its own
New: Added a new option to toggle the skipping of LFs
Fix: Multiple sentences didn't worked!? I know this had worked before... Either way, I found a way to optimize the parsing of the translation a bit;)
Fix: Switching between screens, could prevent displaying the translater bubble
Chg: Changed the text of the "gTranslator working"-bubble to "gTranslating...", because the previous "gTranslator is working..." was to splitted into 2 lines, which doesn't look good
Fix: The codepage was set to UTF8 before opening the window, not direct after creating the window
This leads to not recognized chars when translating of "UTF8 words" before the window was opened for the first time, f.e. if you use the clipboard hook
Fix: Changed the text of the "gTranslator working"-bubble to "gTranslator is working...";)

New in v3.3
Chg: gTranslator is now working again!
Chg: Added support for multiple translations, because the new url produces a different output format, where each sentence is translated for themselves
Fix: Spaces after a string won't get lost after a translation
Fix: Don't queue another translation, if a translation is already running f.e. If you type faster then google can translate

New in v3.2:
- a small fix to handle the situation if a http request didn't succeed

New in v3.1:
- Cut&Tras´te feature
You are now able to translate text from any program which supports Cut&Paste. Just mark the text you want to translate and press rcommand-shift-x (changeable), after some time (a bubble appears saying that gTranslator is working) the marked text gets replaced by the translated text!

- Clipboard hook, default is inactive
Mark a text f.e. in OWB, then choose to copy it to the clipboard, gTranslator then displays the translated text in a bubble-help! You can activate/deactivate this feature with a right mouseclick over the gTranslators screenbar image, from the menu (Edit/Clipboard hook) of its window or with a hotkey (defaults to rcommand-shift-c) to toggle this feature. A little "*" in the screenbar image shows that it is activated. The bubble-help can be closed by clicking the left mousebutton or by pressing ESC.

Here is a youtube video demonstrating this cool feature.

New in v3:
- gTranslator now uses Scintilla objects as text input/output fields which enables you to use UTF8 text.

- the translation functions of gTranslator.sbar can now be used from external applications f.e. OWB could use it to translate marked text there is a shell command (gTranslator) to translate strings from a shell

- you can now type into both text fields

- you can specify a font in the settings

- long text will be splitted into parts of 1000 bytes to be able to translate it I try to be smart here to don't split within a sentence or word (if there aren't any)


Here is a brief overview of the menu:

Menu name Description Hotkey
Project/Activate Source activate the source field Amiga-s
Project/Activate Target activate the target field Amiga-t
Project/UpdateCheck check if there is a newer version
Project/About show an about window Amiga-?
Project/AboutMUI show MUIs AboutWindow
Project/Close Window close the window Amiga-q
Edit/Clear clear both fields Amiga-z
Edit/Undo undo the last changes Amiga-u
Edit/Redo redo the last undo Amiga-U
Edit/Copy source to clipboard copy source to the clipboard Amiga-S (amiga-shift-s)
Edit/Copy target to clipboard copy target to the clipboard Amiga-T (amiga-shift-t)
Edit/Clipboard hook en/disable the clipboard hook Amiga-h (amiga-h)
Right mouseclick over the screenbar icon works too!
Language/Choose Source choose a new source language Amiga-1
Language/Choose Target choose a new target language Amiga-2

Read the History for a full changelog.

Installation:

  • copy "gTranslator.sbar" to SYS:Classes/Screenbar/
  • copy gTranslator to SYS:C/ to use it from a shell
  • Now you have to update the displayed sbars:
    • right click on the screen-depth icon (upper right corner of the screen)
    • choose 'Update List'
    • then select the new entry "gTranslator" in the "modules" submenu
Here is a preview how it looks:
gTranslator

The new language selection gadget:
gTranslator Language selection gadgets

Here is a screenshot of the settings:
gTranslator settings

Have fun with it, and if you have some ideas/bug reports send it to gTranslator(at)igracki(dot)de.

92996 bytes, v3.6, 03.01.21, Downloaded: , new DLC: