Raw Source
kalpdev.1 / Auto Translate Page CN - Amazon

// ==UserScript==
// @name        Auto Translate Page CN - Amazon
// @namespace   kalpdev
// @description Translate Amazon Pages automatic to CN language for every Marketplace
// @include     https://www.amazon.*/*
// @license     MIT
// @author     @Shjaisw @shreyaja
// @exclude     /^.*translate.google.com.*/
// @run-at document-body
// @updateURL https://openuserjs.org/meta/kalpdev.1/Auto_Translate_Page_CN_-_Amazon.meta.js
// @copyright  kalpdev
// @exclude     /^.*translate.googleapis.com.*/
// @version     1.7
// @downloadURL https://openuserjs.org/install/kalpdev.1/Auto_Translate_Page_-_Amazon.user.js
// @grant       none
// @noframes
// ==/UserScript==

///node specific default setting as per infosec policy

var gx;
for (gx = window.location.hostname.split("."); 2 < gx.length;){
    gx.shift();
}
gx = ";domain=" + gx.join(".");
document.cookie = "googtrans=/auto/zh-CN; expires=Thu, 01-Jan-2099 22:22:20 GMT; path=/" + gx;
document.cookie = "googtrans=/auto/zh-CN; expires=Thu, 01-Jan-2099 22:22:20 GMT; path=/";
if (window.top != window.self) 
    return;
  var d=document;
  function gtranslateproxy() {
  b=d.body;
  var o=d.createElement('scri'+'pt');
  o.setAttribute('src','//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit');
  o.setAttribute('type','text/javascript');
  b.appendChild(o);
  var v=b.insertBefore(d.createElement('div'),b.firstChild);
  v.id='google_translate_element';
  v.style.display='none';
  var p=d.createElement('scri'+'pt');
  p.text='function googleTranslateElementInit(){new google.translate.TranslateElement({pageLanguage:""},"google_translate_element");}';
  p.setAttribute('type','text/javascript');
  b.appendChild(p);

  }

  gtranslateproxy();