Translator

Press (F2) to Translate.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name            Translator
// @name:de         Übersetzer
// @name:en         Translator
// @name:fr         Traducteur
// @name:es         Traductor
// @name:it         Traduttore
// @name:pt         Tradutor
// @name:ru         Переводчик
// @name:zh-CN      翻译器
// @name:ja         翻訳機
// @name:ar         مترجم
// @name:hi         अनुवादक
// @name:tr         Tercüman
// @description     Press (F2) to Translate.
// @description:de  Drücken Sie (F2) zum übersetzen.
// @description:en  Press (F2) to Translate.
// @description:fr  Appuyez sur (F2) pour traduire.
// @description:es  Presione (F2) para traducir.
// @description:it  Premere (F2) per tradurre.
// @description:pt  Pressione (F2) para traduzir.
// @description:ru  Нажмите (F2), чтобы перевести.
// @description:zh-CN 按 (F2) 翻译。
// @description:ja  (F2) を押して翻訳します。
// @description:ar  اضغط على (F2) للترجمة.
// @description:hi  अनुवाद करने के लिए (F2) दबाएं।
// @description:tr  Çevirmek için (F2) tuşuna basın.
// @version         4.1.0.9
// @author          Wack.3gp (https://greasyfork.org/users/4792)
// @copyright       2013+, Wack.3gp
// @namespace       https://greasyfork.org/users/4792
// @license         CC BY-NC-ND 4.0; http://creativecommons.org/licenses/by-nc-nd/4.0/
// @icon            https://translate.google.com/favicon.ico
//
// @match           *://*/*
// @exclude         /^[a-z]{4}.*\/greasyfork\.org\/.*\/4610.*$
// @exclude         https://luna.amazon*
// @noframes
//
// @grant           GM_notification
//
// @compatible      Chrome tested with Tampermonkey
// @supportURL      https://greasyfork.org/scripts/4610/feedback
// @contributionURL https://www.paypal.com/donate?hosted_button_id=BYW9D395KJWZ2
// @contributionAmount €1.00
// ==/UserScript==

/* jshint esversion: 9 */

(function() {
    'use strict';

    const _vault = "4792";
    const _isOriginal = GM_info.script.namespace.includes(_vault);
    const donationUrl = "https://www.paypal.com/donate?hosted_button_id=BYW9D395KJWZ2";

    const sendReviewNote = () => {
        GM_notification({
            title: GM_info.script.name + " by " + GM_info.script.author,
            text: "Translated successfully! \nSupport my work with a coffee or leave a review.",
            onclick: () => {
                const choice = confirm("Thank you for using my script!\n\nClick 'OK' to support me with a small donation (PayPal).\nClick 'Cancel' to visit the Support/Review page.");
                if (choice) {
                    window.open(donationUrl, '_blank');
                } else {
                    window.open(GM_info.script.supportURL, '_blank');
                }
            }
        });
    };

    if (window.location.host.includes('translate.google') || window.location.hostname.includes('.translate.goog')) {
        if (_isOriginal) {
            sendReviewNote();
            console.log(`%c ${GM_info.script.name} %c (Verified Original)`, 
                        "background: #4285F4; color: white; font-weight: bold; padding: 2px 5px;", "color: #4285F4;");
        }
    }

    const runTranslation = (e) => {
        if (e.key === "F2") {
            if (_isOriginal) {
                location.href = `https://translate.google.com/translate?sl=auto&u=${encodeURIComponent(window.location.href)}`;
            } else {
                alert("Please install the Original Version");
                location.href = "https://greasyfork.org/scripts/4610";
            }
        }
    };

    window.addEventListener('keydown', runTranslation, { passive: true });
})();