Textarea, Translator ?
Posted by: slayer
Date: August 09, 2010 01:26AM

Most of the times I test my writings with the google translator.
I have this issue: Sometimes instead of clicking 'From English' I click the separator above the option, that causes a reload of the page and then I lost everything I wrote.

This is how I have the translation options:

Google translator, selected.

First menu> *From (Detect language) *From english *Occidental Europe languages.
Second menu> Spanish selected.



Anybody knows how to stop KM from reload the page?

Re: Textarea, Translator ?
Posted by: SoerenB
Date: August 09, 2010 03:17AM

Hi, slayer,

do you ever need the autodetect feature?

If not, you could simply comment out it's buildMenu line in the translate.kmm:

setmenu($__t,inline,_Translation_From_Autodetect);

Cheers
SoerenB


Back again ...

Re: Textarea, Translator ?
Posted by: siria
Date: August 09, 2010 08:02AM

That's a bit weird, I can't reproduce, but can think of a bunch of other menu tinkerings: Like putting "Translate from ENGLISH" into the menu "Selection", skipping the need to open a second menu... And I'd put this into the user menus.cfg to avoid getting overwritten at a browser update... But am in a hurry right now, and that translation menu is horribly complicated... Soeren? :cool: ;-)
By the way did you know you can define a command to be inserted directly *above* another one? In menus.cfg it goes like this, just a syntax example:
&Copy=ID_EDIT_COPY|ID_COPY_LINK_LOCATION
In a macro the syntax goes like this:
"...menu text","macronameNewAbove","MenuEntryBelow");

Okay, if I just look at Soerens menu line, a very quick guess would be, but no idea if it works:
setmenu(Selection,macro,"Translate from ENGLISH",_Translation_From_EN,"&Translation");



Edited 4 time(s). Last edit at 08/09/2010 08:10AM by siria.

Re: Textarea, Translator ?
Posted by: desga2
Date: August 09, 2010 08:43PM

@ slayer:
What K-Meleon version are you using?
Is true that click in first separator reload the web page, also in 1.6a4, but this happend only when first load of Translate menu. If you changed "Using" translator engine the problem is fixed.
There is some problem/bug in \macros\translate.kmm when menu is created onload that produce first separator (it is added automatically, not defined in macro file) work as "Reload".

K-Meleon in Spanish



Edited 1 time(s). Last edit at 08/09/2010 08:44PM by desga2.

Re: Textarea, Translator ?
Posted by: slayer
Date: August 09, 2010 08:54PM

¿Cómo es eso desga?
¿Tengo que usar babel-fish?
Gracias.

Re: Textarea, Translator ?
Posted by: siria
Date: August 09, 2010 09:23PM

Whow, amazing...
That macro is really sophisticated, and I'd have to study it for hours to just begin to understand how it works!

Have just barely managed to find the command to get "From English" into the Selection menu one level higher. If you like copy the BLUE line below to the end of translation.kmm


_Translate_Google_BuildMenu_Service{
setmenu(_Translation_Services,macro,$_Translate_Google,Translate_Google);

#
######## Slayer-Mod: Adds to Selection Menu
setmenu(Selection,macro,"Translate from ENGLISH","Translate_From(en)","&Translation");
#

}
$_Translate_Services=$_Translate_Services."_Translate_Google_BuildMenu_Service;";

# -------------------------------------------------------------------






Edited 2 time(s). Last edit at 08/09/2010 09:41PM by siria.

Re: Textarea, Translator ?
Posted by: desga2
Date: August 10, 2010 07:30PM

Quote
slayer
¿Cómo es eso desga?
¿Tengo que usar babel-fish?
Gracias.
Da igual el motor que elijas, siempre que inicies K-Meleon tendrás este problema, pero si cambias el motor el problema desaparece, y luego lo vuelves a cambiar para dejarlo con el motor que estabas utilizando y ya no tienes ese problema.
Ejemplo, veo que usas Google;

1) Tools -> Translation -> Using -> Babel Fish
Now the problem is gone.
2) Tools -> Translation -> Using -> Google Translator
Now Google without "the first separator reload" problem.

K-Meleon in Spanish

Re: Textarea, Translator ?
Posted by: slayer
Date: August 11, 2010 09:56PM

@siria: Thanks for the css code, I will try it.
@desga: Is there a way to force the switch between translators using a macro? So each time I start KM, it will change to babelfish, then to google automatically.

Re: Textarea, Translator ?
Posted by: desga2
Date: August 12, 2010 07:01PM

Add this code at the end of translate.kmm macro file:

# -------------------------- First Separator Reload Fix --------------------------
#$OnSetup=$OnSetup."_FSRF;";
# I don't know why not work this fix OnSetup

$OnStartup=$OnStartup."_FSRF;";

_FSRF{
macros($_Translate_ClearMenu_Macro); &_Translate_BuildMenu2;
}

# --------------------------------------------------------------------------------

K-Meleon in Spanish

Re: Textarea, Translator ?
Posted by: slayer
Date: August 12, 2010 09:37PM

Excellent desga! It works perfectly, no more reloads by mistake.

K-Meleon forum is powered by Phorum.