Step1
First of all we want to open a Safari web page, with Command + D shortcut to add bookmarks, choose to add to the "Favorites", named "translation" or anything else can.
<ignore_js_op>
Step2
This page will appear in the top of the Favorites bar, find the "translation" of the collection button and right-click, select Edit Address. Fill in the following code, you can choose one you like to add:
<ignore_js_op>
<ignore_js_op>
Youdao Translate to Chinese:
- Javascript:void (function () {var element = document.createelement (' script '); element.id = ' outfox_seed_js '; Element.charset = ' Utf-8 ', Element.setattribute (' src ', ' http://fanyi.youdao.com/web2/seed.js? ' + date.parse (new Date ( ));d ocument.body.appendChild (element);}) ())
Copy Code
Google Translate to Chinese:
- Javascript:var t= ((window.getselection&&window.getselection ()) | | (Document.getselection&&document.getselection ()) | | (Document.selection&&document.selection.createrange&&document.selection.createrange (). text)); var e= (document.charset| | Document.characterset), if (t!= ") {location.href= ' http://translate.google.com/?text= ' +t+ ' &hl=zh-CN& Langpair=auto|zh-cn&tbb=1&ie= ' +e;} else{location.href= ' http://translate.google.com/translate?u= ' +encodeuricomponent (location.href) + ' &HL=ZH-CN &langpair=auto|zh-cn&tbb=1&ie= ' +e;};
Copy Code
Step 3
This is done, casually open a Foreign language page, click on the "Translate" button in the Favorites bar, you can directly translate this page into Chinese!
Translate the entire Safari page into Chinese,