To create a bookmarklet for a translation engine, follow these steps: Go to your translation engine site. Set the appropriate options such as source and target languages. Enter a dummy Web address to be translated, e.g. "DUMMY_ADDRESS" Run the translation Copy the Web address of the translation page to a text editor. Some translation engine uses frames; in that case, right click (ctrl+click on Mac OS X) the frame of the translated text and choose This Frame | Show Only This Frame. In the text editor, find the dummy address. If the dummy address is somewhere in the middle, replace it with "+escape(location.href)+". Append "; to the end of the line. Add javascript:location.href=" to the begining of the line. For example: http://translate.google.com/translate?u=DUMMY_ADDRESS&langpair=en%7Cfr becomes javascript:location.href="http://translate.google.com/translate?u="+escape(location.href)+"&langpair=en%7Cfr"; If the dummy address is at the end, replace it with "+escape(location.href); and add javascript:location.href=" to the begining of the line. For example: http://translate.google.com/translate?langpair=en%7Cfr&u=DUMMY_ADDRESS becomes javascript:location.href="http://translate.google.com/translate?langpair=en%7Cfr&u="+escape(location.href); If the dummy address is nowhere to be found, then the settings are passed "in the background" and you cannot create a bookmarklet for it. Create a bookmark and set its location to the text in your text editor.
2013年2月20日 星期三
How to Create a Bookmarklet for a Translation Engine
Labels:
Tips
在文字的世界裡尋找心靈的共鳴,遠山藍以溫柔的筆觸分享書籍的力量與生活的智慧。無論是細膩的書評、深刻的人生感悟,還是技術與創新的新奇發現,每篇文章都是一次內心的療癒旅程。希望透過閱讀,帶領讀者在忙碌的生活中找到一片寧靜與啟發。讓我們一起,在書香中遇見更好的自己!
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言