Greasy Fork is available in English.
Mimicks chrome's built-in page translator. Can be used as a userscript (from the context menu or always on) or as a bookmarklet (clicking the bookmark translates the page). For Firefox and chrome
This userscript mimicks chrome's built-in page translator. It can be used as a userscript (from the context menu, or, always on) or as a bookmarklet (clicking the bookmark translates the page). Works in Firefox and in chrome. It has been tested with Tampermonkey and Violentmonkey.
Since June 2023, the built-in translation in old versions of chrome has stopped working. This sparked the idea to bring the feature back to those users who are still sticking to their old programs, and make it more flexible and browser independant. It should works in all versions of Firefox and chromium-based browsers. If you experience problem in older versions, feel free to contact me.
The only cave-at is that it uses google translate. You are warned.
Webmasters have always been able to add a widget to integrate the service to their site to allow their foreign visitors to translate the page on the fly.
The userscript is using this script on all pages, which allows complete inline translation of pages and frames.
The target language is saved site by site in a session cookies. A default language can be set. See below in the section on how to install as a bookmarklet.
The menu has other commands: (items are usually hidden and are all displayed here as a convenience)
¿?
, is there if the language used in the toolbar is incorrect. When clicked it selects the language used in your browser's interface and displays a list of country codes to choose from. You'll have to reload the page to take effect.
As a userscript (context menu)
By default when installed in Tampermonkey, the userscript is accessible through the browser's context-menu of the page. Right-click over the section of a page (eg. a frame), click on "Tampermonkey" and then on the userstyle's name in the submenu. This is the prefered method if you don't need to translate too often.
This functionality is not available in Violentmonkey where the other method is used.
As a userscript
In this configuration, all the websites will be subjected to translation. You can disable this for each site separately, but the default option is to translate. You can configure the script to work the opposite way: never translate unless called from the trigger, or if the site is set to auto-translate.
Switching between the 2 configurations (Tampermonkey only)
In Tampermonkey, open the userscript, click the "Settings" tab. In the 2nd section, "General" "Run at", change between Default
(or context-menu
) and document-idle
. When document-idle
is set the context menu entry disappears.
==/UserScript==
, starting with javascript:
up until the end.
en
for english, fr
for french, etc.) between the "" after var defLang=
?
. The userscript will try to use the language of the browser.
toolbarLang=
If a cookie is set, it has precedence over other configurations.
The session cookie is always set when a translation is attempted. Except for sites where cookies are blocked by configuring your browser.
The userscript contains several translations for the added buttons and menu items. Except for languages that I know, or poorly know, they are taken as-is from google translate. Forgive me for the errors.
The translations included are: french, dutch, spanish, italian, german, portuguese, japanese, chinese (simplified and traditionnal).
If the website that you want to translate is configured to block inline script, the translation won't work. Parts of google translate scripts will be blocked.
If you encounter any problem when running it in older browsers, feel free to contact me.
For more userscripts, styles, extensions, tips, ..., visit my programming page.