I started dabbling with FireFox add-ons yesterday. Pretty quickly I had published my first simple add-on. This post will be my documentation.
The premise is simple, I wanted to be able to highlight text then right-click and have a new Google Translate tab open with the text translated. I often highlight text, right-click then type ‘s’ to search in Google. I wanted to do the same (without switching FireFox’s search engine), but send the text to Google Translate.
The context menu shortcut key for Right-Click Translate is the letter ‘t‘.
It uses the new higher level API, so add-on can be installed without requiring FireFox to be restarted.
Here is the latest version of the add-on on mozilla.org https://addons.mozilla.org/en-US/firefox/addon/right-click-translate/
v0.1 Released version that translates to English only.
v0.2 Added preference support to change the target language to any supported by Google Translate
v0.3.0 Tab now opens beside current tab (instead of stuck at the end of all open tabs).
-still have not delved into fixing issue with spaces as it looks like a big job, will get to it when I have time.
v0.3.1 Issue uploading to addons.mozilla.org, had to increment the version number to get it working.
v0.3.2 Added icon to menu item to make it easier to find
- Full page translation if no text selected
- Customizable access key (maybe ‘t’ is already taken or you do not have it on your keyboard)
This plugin is pretty simple, I doubt any support will be required. However, feel free to leave a comment below if you are having trouble, find a bug, or have any suggestions.
3 thoughts on “Right-Click Translate FireFox Add-On”
[EDIT: Fixed! Issue fixed by Mozilla staff in Firefox internals]
NOTE TO SELF: found a bug! did not think it was possible =)
For whatever reason, gaps between paragraphs are not being read as gaps. When words are not separated or only separated by, for example, a ‘.’ the words do not get translated. This is not the only situation though, check the examples.
Here are two examples with original URLs and Google Translate URLs:
Would you consider adding firefox Electrolysis support?
You are not the first person to ask me this for some reason. So I will post this answer here for all to see.
I cannot see what benefits there would be in adding Electrolysis support. This add-on is essentially a one-liner that opens a new tab. There are no background processes. There is no need for more than one thread. I cannot see why it would need to be sand-boxed for security (if you can think of a use-case let me know).
So there you go, I have considered it. There is no point in using it in this very basic and simple add-on :-)