This sbar module allows you to use the google translator feature 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 one of
the input fields.
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.
Clipboard-Hook:
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.
Here is a short video demonstrating this feature:
https://www.youtube.com/watch?v=T4MslPOpk2k
If you have suggestions or bug reports, don't hesitate to email me!
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...";)
What has changed 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
What has changed in v3.2
- Fix: A failed http request will crash your system, I noticed that because it
seems
google stoped the translation service I am using;(
I hope this is only temporaly...
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.
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)
The menus:
"Project/Activate Source" - activate the source field, hotkey: Amiga-s
"Project/Activate Target" - activate the target field, hotkey: Amiga-t
"Project/UpdateCheck" - check if there is a newer version
"Project/About" - show an about window hotkey: Amiga-?
"Project/AboutMUI" - show MUIs AboutWindow
"Project/Close Window" - close the window, hotkey: Amiga-q
"Edit/Clear" - clear both fields, hotkey: Amiga-z
"Edit/Undo" - undo the last changes, hotkey: Amiga-u
"Edit/Redo" - redo the last undo, hotkey: Amiga-U
"Edit/Copy source to clipboard" - copy source to the clipboard, hotkey: Amiga-S
(amiga-shift-s)
"Edit/Copy target to clipboard" - copy target to the clipboard, hotkey: Amiga-T
(amiga-shift-t)
"Edit/Clipboard hook" - en/disable the clipboard hook hotkey: Amiga-h
(amiga-h)
You can also toggle it with a right mouseclick over the screenbar icon!
"Language/Choose Source" - choose a new source language, hotkey: Amiga-1
"Language/Choose Target" - choose a new target language, hotkey: Amiga-2
Read the gTranslator.history for a full changelog.
------------
Installation:
------------
1) copy "gTranslator.sbar" to SYS:Classes/Screenbar/
2) Now you have to update the displayed sbars:
- right click on the screen-depth icon (upper right corner of the screen)
- if you already had gTranslator running, you have to delesect it first
(in "modules" submenu)
- choose 'Update List'
- then select the new entry "gTranslator" in the "modules" submenu
3) copy "gTranslator" to SYS:C/
-------
History:
-------
13-Mar-15: v3.1, released
New: If the source text field is active and if its set to auto, but you are
copying a text
in the target language, gTranslator recognizes this and retranslates to the
home language!
Example: Source is auto, target is english, home language is german, source
text field is active
You are then able to translate from german to english and english to german,
without opening
the window and change the active text field
New: Added a settable global hotkey to switch the clipboard hook (default:
rcommand shift c)
Chg: Changed the settings layout a bit, added some shorthelp
28-Feb-15:
Chg: Don't open my window if you copy something to the clipboad instead show
the
translated string in a bubble at mouse position
You can close the bubble with ESC or LMB
Fix: If needed (if its utf8) convert the translated string to system codepage
if its
shown in a bubble
27-Feb-15:
New: If the clipboard hook is enabled, a little "*" is drawn into the sbar
image
26-Feb-15:
Fix: Preserve the "Menu/Edit/Clipboard hook" setting, when the window is
recreated
25-Feb-15:
New: You can switch the clipboard hook with a right mousebutton click over the
screenbar image!
Fix: The CutAndTraste bubble was only displayed on the Ambient screen
New: Added a bubble help ("gTranslator working...") at mouse position to
indicate
the user that the translation for the CutAndTraste-Feature is in progress,
cause sometimes it can take some seconds
23-Feb-15:
Chg: changed Cut&Traste-Feature to use the scintilla objects to read/write
from/to clipboard
because of the handling of utf chars
18-Feb-15:
New: added the Cut&Traste-Feature, if you press a definable hotkey (default
rcommand-shift-x)
gTranslator cuts the selected text in any program (which supports rcommand-x)
and replaces
it with the translated text!
The windows mouse pointer will be set to the sleep pointer
17-Feb-15:
Chg: My input handler now has a priority higher than CygnusEd
16-Feb-15:
Chg: remember the active field on win close/open
New: added a clipboard hook, Menu/Edit/Clipboard hook
if enabled, all text copied to the clipboard (if my own window is NOT
active!)
will be pasted into the active text field and translated!
the window will be opened if it was closed
fix: paste from the contextmenu of the inactive text field will activate the
text field
25-Jan-15:
fix: Changing the font in the sbar-prefs only takes effect if you click in one
of the text fields
now it changes immediatly
[reported by Markus Lunk, 23-Jan-15]
fix: If the window opens the first time, the user sees my changes (remove first
column) to the text fields
07-Dec-14:
Chg: Now the destination field should have the same line visible as the source,
when you edit a long text
Note:
This only works if they have the same number of lines, which isn't always
the case if line wrap is in use!
Fix: unpush unnecessary pushmethods for deleting the bubble
New: Added undo/redo menu items
Fix: The background color of selected text and the background color of the
inactive
field was the same, I'm now using a light blue for selected text's background
color
Fix: Menu/Edit/Clear now clears both text fields, instead of only the active
This fixes the horizontal scrollbar (if line wrap isn't used)
16-Nov-14: v3.0, released
Chg: The auto-lang-bubble is now displayed as a bubble over the source language
selector
while you are typing and will disappear after 3 seconds in addition the
shorthelp
of the source language selector is also set to this language
10-Nov-14:
New: Added two library functions for external apps
GetSourceLang() to get the source language, usefull if you set TL to auto
GetLangName() to get the language name from its shortcut (f.e.
GetLangName("de") returns "German")
03-Nov-14:
New: If the source language is set to auto, the recognized language is
displayed as a calltip!
30-Sep-14:
New: Added rcommand-tab to switch between the source and target field
30-Aug-14:
Fix: NotifyLoop (between the two sci objects) could happen sometime
New: LineWrapping is now set for both sci objects (should I make this
optional?)
23-Aug-14:
New: Added some menuitems:
"Project/Activate Source" to activate the source field, hotkey: Amiga-s
"Project/Activate Target" to activate the target field, hotkey: Amiga-t
"Project/Close Window" to close the window, hotkey: Amiga-q
"Language/Choose Source" to choose a new source language, hotkey: Amiga-1
"Language/Choose Target" to choose a new target language, hotkey: Amiga-2
22-Aug-14:
Chg: The active Scintilla object now has a different background (white) then
the inactive (grey)
20-Aug-14:
Chg: Finally exchanged the TextInput objects with Scintilla objects, with the
advantage that
you are now able to enter and display utf8 text!
New: Added a "Font" setting to the prefs, default is "Liberation Mono/15"
Chg: Raised the limit from 500 to 1000 bytes for splitting long text, lets see
if its too much...
08-Aug-14:
Chg: I now try to be smart when splitting a long (>500 chars) text:
It gets split not exact a the 500th position, but at the end of the prev
sentence
(delimited by a ".", ",", "!", ":" or a "?" followed by " " or "\n") or if
not found
at the previous " "
Fix: Fixed some google strangeness, when there is a space after a linefeed
30-Jul-14:
Chg: The arrow is now a "<->" symbolising that you can also translate from
target to source
Fix: If the clear the source/targt field, the lamp is set to off
New: Remember the current position before setting the translated text, and
reset it afterwards
(usefull, if you change something at the end of a long text)
28-Jul-14:
New: Added a menu to the window
"Project/UpdateCheck" - (not yet implemented)
"Project/About" - (not yet implemented), hotkey:
Amiga-?
"Project/AboutMUI" - show MUIs AboutWindow
"Edit/Clear" - clear both fields, hotkey:
Amiga-z
"Edit/Copy source to clipboard" - copy source to the clipboard, hotkey:
Amiga-S
"Edit/Copy target to clipboard" - copy target to the clipboard, hotkey:
Amiga-T
27-Jul-14:
New: Added multipart translation, in parts of 500 bytes, I have so see if this
is the right amount
20-Jul-14:
New: Its now possible to write in the second text field to translate from the
target to
the source language, if source if auto, the home language will be used
[suggested by jPV, 18-Jun-14]
Rem: Removed the possibility to click on the arrow to swap the languages,
because you
can now write in the second text field
New: Added a small lamp object under the arrow to indicate when gTranslator is
"working"
16-Jul-14:
New: Added "-" as a hotkey to swap the languages
You can use Amiga and "-" if the text field is active!
New: Its now possible to open the sbar as a library and then use the
Translate() function
from every program!
(would be cool if f.e. OWB would support it to translate marked text...)
New: Added a small shell tool (gTranslator) to translate strings from a shell
14-Jul-14:
New: Added cursor keys to change the selected entry in the LanguageSelector
07-Jul-14:
Chg: The source language selector in the settings is now also displayed with 9
columns
06-Jul-14:
New: Clicking the arrow (->) between the language selectors, will swap the
languages
If source if auto, the home language will be used
[suggested by jPV, 18-Jun-14]
New: Added hotkeys to source ("1") and target ("2") language selectors
to select the gadgets via a hotkey
Chg: The source language selector is now displayed with 9 columns,
so the last language isn't displayed alone in an own row anymore
18-Jun-14: v2.01, released
Fix: Forgot to disable debug code in some modules, the filesize is now only
half as large!
[reported by jPV, 18-Jun-14]
Chg: Changed the window title to just "gTranslator.sbar vX.X"
13-Jun-14:
Fix: The hotkey setting is now in a own group ("Misc."), instead of the
"Languages" group
13-Jun-14: v2.0, released
Chg: Added "#" to the translated chars
Fix: The chars "<" and ">" needed special handling
08-Jun-14:
New: All language selection gadgets are now a custom popup subclass with an
8-column
table instead of a cycle gadget
Chg: Changed the layout of the window, the language selection gadgets are now
above
the text gadgets
26-Mai-14:
New: The hotkey is now adjustable! Default is now "alt #"
Because Powerbook doesn't have a right ctrl key;)
22-Mai-14
Chg: the window and slave object are now global for all instances
21-Mai-14:
Chg: The InputHandler is now global, for all instances/screens
New: Now using Textinputscroll objects, to have scrollbars, because
ScrollgroupObjects
seems to not working with Textinput objs!?
Unfortunately the Textinputscroll doesn't have support for AutoBars, like
ScrollgroupObjects...
20-Mai-14:
New: Added a hotkey (ctrl #) to open/close my window!
Fix: Chinese language name was wrong
[reported by Markus Lunk]
17-Mai-14:
Chg: Added "\t", "\n" and "+" to the translated chars
11-Mai-14:
Fix: The url string was limited to 200 chars, its now unlimited
but it seems that there is somewhere a limit (1958 chars)
[reported by Markus Lunk]
07-Mai-14:
New: Changed the url to translate, so its working again, w/o the need for
https!
New: Instant translation, words are translated while you are typing
[suggested by Markus Lunk]
New: The cycle-gadgets for the languages can now jump to first/next language by
typing the first letter of the language
[suggested by Markus Lunk]
New: Added a "Home Language" setting, so unknown words are set to this
language
(doesn't work everytime though)
New: The window width/height is now remembered
New: Set max length of the source string gadget is now "auto expanded"
New: The string- and the text(result)-gadget have now multiline support
30-Apr-14:
Tried to use Scintilla.mcc instead of String.mui
- How can I only get a notification for a specific type (f.e. SCN_MODIFIED),
else I get every
second a notification;(
- How can I deactivate it? (to activate the cycle gadget via keyboard)
else it gets all the keyboard inputs...
- how can I disable the first column?
27-Apr-14:
Chg: The window width is now remembered
Chg: Added custom cycle gadgets, you are now able to choose an entry by typing
the first
letter, if the gadget is the active object!
Select a cycle gadget with the TAB key, then press a-z.
Chg: The text gadget (where the translated string is shown), isn't in the cycle
chain anymore
Chg: The string gadget is now a StringHistory object (you need to install this
class!)
TODO: make it optional
25-Apr-14:
-Fix: Now the window will open if you release the left mousebutton instead of
on pressing it!
To prevent the window from beeing deactivated right after opening on
Ambient!
21-Apr-14: v1.0, first release
17-Apr-14: started
|