Forced zh-TW for translate.google

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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()
    }
}