>Форум Mozilla Россия http://forum.mozilla-russia.org/index.php >Поддержка пользователей http://forum.mozilla-russia.org/viewforum.php?id=26 >Переводчик http://forum.mozilla-russia.org/viewtopic.php?id=48386 |
hakim2012 > 01-03-2011 21:01:16 |
Подскажите такой плагин, с которым можно в мозилле переводить английские сайты? И объясните пожалуйста как им пользоваться. |
bunda1 > 01-03-2011 21:13:57 |
Результаты поиска дополнений для translat :: Дополнения Firefox |
Йцукен > 01-03-2011 21:15:39 |
Babelfish переводит не только английские, но и почти любые. Настроить на перевод Source Language - AutoDetect (xx) на Target Language - Russian. Перевод целых страниц и частей текста через меню правой кнопки мыши и, кроме того, по сочетаниям клавиш и щелчков мышью (всё в настройках). |
bunda1 > 01-03-2011 21:19:17 |
Чтобы перевести любую страницу на русский язык, нужно создать новую закладку с названием Перевести (не столь важно название), с адресом (URL): javascript:document.location = 'http://translate.google.ru/translate?js=n&prev=_t&hl=ru&ie=UTF-8&layout=2&eotf=1&sl=auto&tl=ru&u=' + top.location.href + '&act=url' или javascript:var%20t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var%20e=(document.charset||document.characterSet);if(t!=''){location.href='http://translate.google.com.ua/?text='+t+'&hl=ru&langpair=auto|ru&tbb=1&ie='+e;}else{location.href='http://translate.google.com.ua/translate?u='+encodeURIComponent(location.href)+'&hl=ru&langpair=auto|ru&tbb=1&ie='+e;}; |
Йцукен > 01-03-2011 21:26:34 |
bunda1 javascript:var%20t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection%20&&document.selection.createRange&&document.selection.createRange().text));var%20e=(document.charset||document.characterSet);if(t!=''){location.href='http://translate.google.com/translate_t?text='+t+'&hl=ru&langpair=auto|ru&tbb=1&ie='+e;}else{location.href='http://translate.google.com/translate?u='+escape(location.href)+'&hl=ru&langpair=auto|ru&tbb=1&ie='+e;}; Как создавать подобные закладки для перевода ПРОМТом (только вся страница), я объяснял в той самой теме. bunda1 пишет
Вообще-то это не URL, а скрипт, но вставлять надо всё равно в строку «Адрес». |
bunda1 > 01-03-2011 21:31:31 |
Радик245 скрытый текст Выделить код Код:const UJS_TOOLBAR_ID = "ujs_toolbar"; const UJS_GOOGLE_TRANSLATE_FRAME_ID = "ujs_googletranslateframe"; function cbTranslatorButton (browser) { this. doc = browser. contentDocument; this. win = browser. contentDocument. defaultView; } cbTranslatorButton. prototype = { doc: null, win: null, toolbar: null, clse: null, frame: null, grabX: 0, origX: 0, grabY: 0, origY: 0, handleEvent: function (event) { switch (event. type) { case "mousedown": this. tbOnMouseDown (event); break; case "mousemove": this. tbOnMouseMove (event); break; case "mouseup": this. tbOnMouseUp (event); break; case "click": this. clseOnClick (event); break; case "load": this. frameOnLoad (event); break; default:; } }, tbOnMouseMove: function (event) { this. toolbar. style. left = this. origX + event. clientX - this. grabX + 'px'; this. toolbar. style. top = this. origY + event. clientY - this. grabY + 'px'; }, tbOnMouseUp: function (event) { this. doc. removeEventListener ('mousemove', this, false); this. toolbar. style. zIndex = 9997; }, tbOnMouseDown: function (event) { if (event. target == this. toolbar) { event. preventDefault (); this. toolbar. style. zIndex = 9998; this. grabX = event. clientX; this. grabY = event. clientY; this. origX = parseInt (this. toolbar. style. left); this. origY = parseInt (this. toolbar. style. top); this. doc. addEventListener ('mousemove', this, false); this. doc. addEventListener ('mouseup', this, false); } }, removeEventListener: function (element, eventType, captureFlag) { try { element. removeEventListener (eventType, this, captureFlag); } catch (err) {} }, removeElement: function (element) { try { element. parentNode. removeChild (element); } catch (err) {} }, clseOnClick: function (event) { this. clse. removeEventListener ('click', this, false); this. removeEventListener (this. toolbar, 'mousedown', false); this. removeEventListener (this. doc, 'mousemove', false); this. removeEventListener (this. doc, 'mouseup', false); this. removeEventListener (this. frame, 'load', false); this. removeElement (this. toolbar); this. removeElement (this. frame); this. frame = null; this. clse = null; this. toolbar = null; this. win = null; this. doc = null; }, ujs_createWindow: function (txt) { var doc = this. doc; var win = this. win; var h, w; var txtLen = txt. length; var tbId = UJS_TOOLBAR_ID; if (arguments. length > 2) tbId += arguments [2]; var toolbar = doc. getElementById (tbId); if (toolbar) toolbar. parentNode. removeChild (toolbar); toolbar = doc. createElement ('div'); this. toolbar = toolbar; toolbar. id = tbId; if (arguments. length == 5) { w = arguments [3]; h = arguments [4] } else { h = 15; w = 20; if (txtLen > 2000) { h = 50; w = 66 } else if (txtLen > 250) { h = 25; w = 33 }; h = parseInt (h * win. innerHeight / 30); w = parseInt (w * win. innerWidth / 50) }; var title = (arguments. length > 1) ?arguments [1]: '<a href="http://translate.google.com/" target="_blank" style="text-decoration:none;color:#000099;font:16px Times New Roman;">Google Translate</a>'; toolbar. innerHTML = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAABh0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjIyt5EXfQAAAStJREFUOE+1k9tqhDAQhtOHqO37P4E3IlQFQQSvBBVEl1TBVVi1B+1C8XAx3QmNqIVqhBV+DEPmy8z8ycPX9Ruq6kLqqiRHvkfpiUjSMyGUJtB1HfR9D8MwCAlz6voNkEGCIGDJeZ5DURTCatoWNE0D4nk+jOMoDMBD8fDPpoGXu4OyLAPUutV1/N+KcPPNPaY4jidYktwG+hunlLL4ZmsI4EloxhxiGAY4jgNpmm6D8DQEcBj/I8SyrKnSzYr4bDzPm2CKoiwgu1rDTfN2eEWu6y4M2KxoPRNVVRcz4xXvdm0+k/nMwjDc5xraa9v2n5kgwDRNMdfQXtT6Us7jy9Z8n738Iw82O5/hUpag6zqQ0+kVmqZld0NUURSxl48M8v5xZQtZlg8Jc5HxA5fIE73hTda3AAAAAElFTkSuQmCC" title="Close" width="18" height="18"> ' + title + '<div></div>'; toolbar. setAttribute('style', 'position:fixed;background:white;display:block;visibility:hidden;left:0;top:0;height:auto;width:' + w + 'px;font:16px Times New Roman;border:1px solid gray;padding:3px;z-index:9997;overflow:visible;cursor:move;'); toolbar. addEventListener ('mousedown', this, false); var clse = toolbar. firstChild; this. clse = clse; clse. setAttribute ('style', 'float:right;background:white;padding:0;margin:0;border:none;cursor:pointer;'); clse. addEventListener ('click', this, false); var textbar = toolbar. lastChild; textbar. innerHTML = txt; textbar. setAttribute ('style', 'display:block;border:1px solid #aaaaaa;margin:2px 0 0 0;padding:4px;background-color:#fafcfe;font:14px Times New Roman;height:' + h + 'px;width:auto;overflow:auto;cursor:text;'); doc. documentElement. appendChild (toolbar); var halfWidth = parseInt (toolbar. offsetWidth / 2); var strict = doc. compatMode == 'CSS1Compat'; var mX = (strict? doc. documentElement. clientWidth: doc. body. clientWidth) - toolbar. offsetWidth; var mY = (strict? doc. documentElement. clientHeight: doc. body. clientHeight) - toolbar. offsetHeight; var lastClickX = win. cbTranslateButton2X; var lastClickY = win. cbTranslateButton2Y; toolbar. style. left = ((lastClickX < mX + halfWidth)? (lastClickX > halfWidth? (lastClickX - halfWidth): 0): mX) + "px"; toolbar. style. top = ((lastClickY < mY)? lastClickY: mY) + "px"; toolbar. style. visibility = 'visible'; return textbar; }, frameOnLoad: function (event) { var fr = event. currentTarget; fr. removeEventListener ('load', this, false); var tbId = fr. id. substring (UJS_GOOGLE_TRANSLATE_FRAME_ID. length); var toolbar = this. doc. getElementById (UJS_TOOLBAR_ID + tbId); var frdoc = fr. contentDocument; var a = frdoc. getElementById ('autotrans'); var title = (a && !/#808080/. test (a. innerHTML))? ' - ' + a. textContent. replace (/^.+: | [(\xBB].+$/g, ''): ''; var result = frdoc. getElementById ('result_box'). innerHTML; var ancor = toolbar. getElementsByTagName ("a") [0]; ancor. innerHTML += title; ancor. nextSibling. innerHTML = result; setTimeout ( function () { fr. parentNode. removeChild (fr); }, 0 ); }, google_translate: function (language) { var doc = this. doc; var win = this. win; var t = document. commandDispatcher. focusedWindow. getSelection (). toString (); var lng = (win. navigator. language == 'ru')? 'ru': 'en'; if (t && location. hostname != 'translate.google.com') { this. ujs_createWindow ( (lng == 'ru'? '\u041F\u0435\u0440\u0435\u0432\u043E\u0434\u0438\u043C': 'Translating' ) + '\u2026', '<a href="http://translate.google.com/" target="_blank" style="text-decoration:none;color:#000099;font:16px Times New Roman;">Google Translate</a>', btoa (escape (t)) ); var gtfId = UJS_GOOGLE_TRANSLATE_FRAME_ID; var fr = doc. getElementById (gtfId); if (!fr) fr = doc. createElement ('iframe'); this. frame = fr; fr. setAttribute ('id', gtfId + btoa (escape (t))); fr. setAttribute ('frameborder', '0'); fr. setAttribute ('style', 'width:0px;height:0px;visibility:hidden;position:absolute;left:-999em;'); fr. setAttribute ( 'src', 'http://translate.google.com/translate_t?text=' + encodeURIComponent (t) + '&hl=' + lng + '&langpair=' + language + '&tbb=1&ujs=gtt' ); fr. addEventListener ('load', this, false); doc. documentElement. appendChild (fr); } else { getBrowser (). addTab ( 'http://translate.google.com/translate?u=' + escape (doc. location. href) + '&hl=' + lng + '&langpair=' + language + '&tbb=1' + (doc. charset? '&ie=' + doc. charset: ''), null, null ); } } }; var ct = getBrowser (). selectedTab; if (!ct. cbTranslateButton5) ct. cbTranslateButton5 = []; var translator = new cbTranslatorButton (getBrowser ()); ct. cbTranslateButton5. push (translator); translator. google_translate ("auto|ru"); |
Йцукен > 01-03-2011 21:36:42 |
bunda1 01-03-2011 21:39:02 — переводит именно с английского (может оказаться полезным, если на странице текст на двух или более языках, напр., русский и английский). |