Greasy Fork is available in English.

Google Translate - Switch Languages Hotkey

Makes tab a hotkey to swap languages.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Google Translate - Switch Languages Hotkey
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Makes tab a hotkey to swap languages.
// @author       Meztihn
// @match        http*://translate.google.com/*
// @match        http*://translate.google.co.uk/*
// @match        http*://translate.google.ru/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const tabKeyCode = 'Tab';
    const sourceTextArea = document.getElementById('source')
    const swapLanguagesButton = document.getElementById('gt-swap');

    sourceTextArea.addEventListener('keydown', onKeyDown, { capture: true });

    function onKeyDown(event) {
        if (event.code === tabKeyCode) {
            swapLanguages();
            event.preventDefault(); // prevents active element change and thus focus lose
        }
    }

    function swapLanguages() {
        click(swapLanguagesButton);

        // Standard click() doesn't work
        function click(button) {
            button.dispatchEvent(new MouseEvent('mouseover'));
            button.dispatchEvent(new MouseEvent('mousedown'));
            button.dispatchEvent(new MouseEvent('mouseup'));
        }
    }
})();