Forced zh-TW for translate.google

Force setting Traditional Chinese as the target language, reject Simplified Chinese

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Forced zh-TW for translate.google
// @namespace    https://greasyfork.org/zh-TW/scripts/399503-forced-setting-zh-tw-for-asian-languages-of-translate-google
// @namespace    http://tampermonkey.net/
// @version      0.11
// @description  Force setting Traditional Chinese as the target language, reject Simplified Chinese
// @author       You
// @match        translate.google.com/*
// @match        translate.google.com.tw/*
// @grant        none
// ==/UserScript==

chkLang()

window.onclick = function() {chkLang()}

function chkLang() {
    const cURL = new URL(window.location.href)
    if (cURL.href.search("tl=zh-CN") != -1) {
        cURL.href = cURL.href.replace(/tl=zh-CN/g,"tl=zh-TW")
        window.location.href = cURL.href
        //location.replace(cURL.href)
        location.reload()
    }
}