General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Google Translate
Posted by: foobarly
Date: January 30, 2008 11:45PM

The evident superiority of Google Translate to Babelfish (Altavista), which is the default K-Meleon engine, has been nagging me for a while; because of this, although I know very little of the macro language, I decide to fiddle with the translate.kmm macro...

I got to it via K-Meleon's "Edit|Configuration|Macros" which basically shows the content of the macro folder; translate.kmm is just one of the plain text files sitting there.

After backing it up, I substitued the following lines from the 'PRIVATE' section:
$_Translate_srvc=_("Babel Fish Translation");
$_Translate_text="http://babelfish.altavista.com/babelfish/tr?lp=<from>_<to>&urltext=";;
$_Translate_page="http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=<from>_<to>&url=";;

with these:
$_Translate_srvc=_("Google Translate");
$_Translate_text="http://translate.google.com/translate_t?langpair=<from>;|<to>=";
$_Translate_page="http://translate.google.com/translate?&langpair=<from>;|<to>&u=";

Well, I got the full page translation working; unfortunately, the text selection isn't.

Looking around for help, I found the javascript of the Google buttons that are available in the 'Tools' tab of the Google Translate page. Since I can't make heads or tails of it, here it is, hoping that someone more enlightened can solve this riddle (line breaks added, denoted by §).

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/translate_t?text='+t+'&hl=en&langpair=de|en&tbb=1&ie='+e;}§
else{location.href='http://translate.google.com/translate?u='+escape(location.href)+'&hl=en&langpair=de|en&tbb=1&ie='+e;};

TIA,



Edited 2 time(s). Last edit at 01/31/2008 01:02AM by foobarly.

Options: ReplyQuote
Re: Google Translate
Posted by: Arrow
Date: January 31, 2008 12:11AM

This is in the bookmarklet i use - not having a clue about these things I don't know if it is of any help to you. think i got if from squarefree
https://www.squarefree.com/bookmarklets/misc.html

[InternetShortcut]
URL=javascript:void(0);void(0);void(0);void(0);void('Add this text into the code to suppress the tooltip with long script');void(0);void(0);void(0);void(0);void(0);void(0);void(0);q=location.href;void(location.href='http://translate.google.com/translate?u='+q);
Modified=C07D988B8513C201BB
DefaultIcon=
IconFile=
IconIndex=1
[WebInformation]
Active=4

Options: ReplyQuote
Re: Google Translate
Posted by: foobarly
Date: January 31, 2008 01:06AM

Thanks, but it looks to me as just another variant of the full page translation -- hence the u= (URL equals...) after the ? (SRU parser???). What I lack is a text selection method...

Options: ReplyQuote
Re: Google Translate
Posted by: desga2
Date: January 31, 2008 11:38AM

Try replace to these code lines in 'translate.kmm' file:

$_Translate_srvc=_("Google Translate");
$_Translate_text="http://translate.google.com/translate_t?langpair=<from>;|<to>&text=";
$_Translate_page="http://translate.google.com/translate_c?hl=<to>&langpair=<from>;|<to>&u=";

Tip: 'translate_c' indicated without top Google frame, 'translate' with top Google frame.

P.S.; To use dictionary instead translate text, use this code:
"http://translate.google.com/translate_dict?hl=<to>&langpair=<from>;|<to>&q="

K-Meleon in Spanish



Edited 4 time(s). Last edit at 01/31/2008 11:59AM by desga2.

Options: ReplyQuote
Re: Google Translate
Posted by: foobarly
Date: February 01, 2008 02:09AM

It works like a charm... U rul Desga2. Many thanks!

Another issue squashed, my K-Meleon gets even more perfect everyday... grinning smiley

Options: ReplyQuote
Re: Google Translate
Posted by: ashraf
Date: May 08, 2008 11:29AM

Quote
desga2
Try replace to these code lines in 'translate.kmm' file:

$_Translate_srvc=_("Google Translate");
$_Translate_text="http://translate.google.com/translate_t?langpair=<from>;|<to>&text=";
$_Translate_page="http://translate.google.com/translate_c?hl=<to>&langpair=<from>;|<to>&u=";

Tip: 'translate_c' indicated without top Google frame, 'translate' with top Google frame.

P.S.; To use dictionary instead translate text, use this code:
"http://translate.google.com/translate_dict?hl=<to>&langpair=<from>;|<to>&q="


Options: ReplyQuote
Re: Google Translate
Posted by: foobarly
Date: May 10, 2008 03:49PM

WWT? :O

(meaning What Was That?)

Options: ReplyQuote
Re: Google Translate
Posted by: Manea Mariana
Date: July 18, 2008 07:43AM

This is how

Options: ReplyQuote
Re: Google Translate
Posted by: guenter
Date: July 18, 2008 11:05AM

@foobarley: No idea what the 2 person with Arab(Kuwait) and Romanian IP want.
Looks like trolls comments.

Greetings to .pt (Lisboa?) from Hannover

Options: ReplyQuote


K-Meleon forum is powered by Phorum.