עוד כלי לתרגום מהיר
לא מהפכני, אבל שימושי:
גרור את הקישור הזה לשורת המועדפים שלך: תרגם
עכשיו, בכל פעם שתיתקל במילה לא מוכרת באנגלית – סמן אותה ולחץ על הקישור. ייפתח חלון התרגום של גוגל עם הפירוש.
לצערי, לשירות התרגום של גוגל עדיין אין API, אז לא ניתן לבצע את זה בדרך אלגנטית יותר…
תיקון (אודי): דווקא יש API. אם אמצא דרך לנצל את זה ל-bookmarklet יעיל יותר – הוא יפורסם כאן.


שיפור קל
javascript:var t=((window.getSelection&&windo….ction.createRange().text));var e=(document.charset||document…..ngpair=auto|iw&tbb=1&ie='+e;};
API
דווקא יש להם API.
http://code.google.com/apis/ajaxlanguage/
וגם עובד נחמד. מתרגם משפטים (לא רק מילים) ויודע לזהות את שפת המקור, בתרגום לאנגלית.
אודי
אודי
אופס – פספסתי. חשבתי שיש להם רק לזיהוי שפה.
תודה על העדכון – יש לי תחושה שאנסה לעשות אם זה משהו…
API
השתמשתי בזה כדי לכתוב כלי פשוט של תרגום בעזרת AUTOIT.
זה נחמד כי אפשר לסמן מה שרוצים (בכל תכנה) ולקבל תרגום. אם אתה מעוניין אני יכול לשלוח לך את זה.
ללא נושא
כמובן…
הנה
לא בטוח שזה יעבור, אבל הנה הקוד. זה קוד של AUTOIT3. אפשר לקמפל אותו לEXE
#include <Misc.au3>
#include <INet.au3>
#include <GUIConstants.au3>
#include <encoder.au3>
;MsgBox(0,"source",_INetGetSource('www.autoitscript.com'))
;
; Simple translation service using Google.
; To use, mark a section of text and click 'pause'
;
;
Global Const $TARGET_LANGUAGE_SPANISH="es";
Global Const $TARGET_LANGUAGE_ENGLISH="en";
$ok=HotKeySet("{PAUSE}", "translate");
$ok=HotKeySet("+{PAUSE}", "terminate");
Global $sourceTextLabel, $targetTextLabel, $mainForm = 0, $timeToCloseWindow;
Global $destLanguage=$TARGET_LANGUAGE_ENGLISH;
init()
While 1
Sleep(10000)
WEnd
func init()
Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown.
Opt("TrayOnEventMode",1) ; event based tray menu
TraySetState ()
TraySetToolTip("Translating to English")
TraySetClick (8)
TraySetOnEvent ($TRAY_EVENT_PRIMARYDOUBLE, "translate")
TrayCreateItem("Translate to English")
TrayItemSetOnEvent (-1 , "setLanguageEnglish")
TrayCreateItem("Translate to Spanish")
TrayItemSetOnEvent (-1 , "setLanguageSpanish")
TrayCreateItem("Exit")
TrayItemSetOnEvent (-1 , "Terminate")
EndFunc
Func createWindow()
if ($mainForm <> 0) Then
; A window already exists. move it to front, and open it
GUISetState(@SW_SHOW,$mainForm)
Return $mainForm;
EndIf
$width=600;
$height=400;
$menuStyle=BitOR($WS_POPUPWIN….S_THICKFRAME,$WS_MINIMIZEBOX);
$menuExstyle=$WS_EX_TOOLWINDOW;
;$menuExStyle=BitOR($menuExStyle, $WS_EX_TOPMOST)
$mainForm = GUICreate("Translated", $width,$height,(@DesktopWidth-….)/2,(@DesktopHeight-$height)/2 , $menuStyle, $menuExStyle);
GUISetBkColor (0x7fffd4);
GUISetFont (12);
$sourceTextLabel = GuiCtrlCreateLabel("Loading…" , 0, 0 , $width,($height/2), $SS_LEFT)
$targetTextLabel = GuiCtrlCreateLabel("Loading…" , 0, ($height/2),$width,($height/2), $SS_LEFT)
GUISetFont (8);
GuiCtrlCreateLabel("Use Pause to translate, Esc to copy the translated text and close this window. Shift+Pause to exit. Use the tray icon to change translation language. Translation is limited to about 200 characters, by the Google API." , 0, ($height-40),$width,40, $SS_LEFT+$SS_SUNKEN );
GUICtrlSetState ($mainForm, $GUI_ONTOP)
GUISetState(@SW_SHOW)
EndFunc
; Sample responses from Google
; {"responseData": {"translatedText":"done"}, "responseDetails": null, "responseStatus": 200}'
; {"responseData": {"translatedText":"casa","detectedSourceLanguage":"en"}, "responseDetails": null, "responseStatus": 200}
; {"responseData": null, "responseDetails": "invalid translation language pair", "responseStatus": 400}
Func callGoogle($text)
;ConsoleWrite ("Translating: " & @CRLF & $text& @CRLF );
$escaped = encodeURIComponent($text);
;ConsoleWrite ($escaped & @CRLF & @CRLF)
;msgBox(0,"Source",$escaped);
$url= "http://ajax.googleapis.com/aj….late?v=1.0&hl=en&langpair=%7C" & $destLanguage & _
"&q=" & $escaped;
ConsoleWrite ("URL: " & $url & @CRLF);
;$translated = '{"responseData": {"translatedText":"this is a sample working fixed translation"}, "responseDetails": null, "responseStatus": 200}'
;sleep (2000)
$translated = _INetGetSource ($url);
;dbg ("Return from Google Service: "& $translated)
;{"responseData": {"translatedText":"Ciao mondo"}, "responseDetails": null, "responseStatus": 200}
;msgBox(0,"target",$translated);
;msgbox(0,"after encoding",decode($translated))
$resposeStatus = StringRegExp ($translated, '"responseStatus": (\d+)\}', 1)
if @error Then
Return "An Error 1 occured during translation:" & @CRLF & $resposeStatus & @CRLF & $translated;
EndIf
if ($resposeStatus[0] <> "200") Then
$responseDetails = StringRegExp ($translated, '"responseDetails": "(.*)"[,}]', 1)
Return "An Error has occured during translation:" & @CRLF & @CRLF & $responseDetails[0];
EndIf
$translatedText = StringRegExp ($translated, '"translatedText":"(.*)","detected', 1)
if @error Then
Return "An Error 3 occured during translation:" & @CRLF & $translatedText & @CRLF & $translated;
EndIf
;dbg ("Translated from Google: " & $translatedText[0] & "|")
;$translatedText = decode ($translatedText[0]);
ConsoleWrite ("Returned: " & @CRLF & $translatedText[0] & @CRLF );
Return $translatedText[0];
EndFunc
func translate()
;copy what is selected now
Send ("^{INSERT}")
Send ("^{INSERT}")
$text=ClipGet();
createWindow();
GUICtrlSetData ($sourceTextLabel , $text);
GUICtrlSetData ($targetTextLabel , "Translating…");
$ok=HotKeySet("{ESC}", "CloseTranslationWindow");
$ok=HotKeySet("{SPACE}", "CloseTranslationWindow");
$translated = callGoogle($text);
$translated = BinaryToString($translated,4);
ClipPut ($translated);
;MsgBox(0, "Translated" , $translated);
;MsgBox(0, "Translated" , decode($translated));
GUICtrlSetData ($targetTextLabel , $translated);
$timeToCloseWindow=100;
While $timeToCloseWindow>0
Sleep ( 100 );
$timeToCloseWindow=$timeToCloseWindow-1;
WEnd
GUIDelete($mainForm);
$mainForm = 0;
$ok=HotKeySet("{ESC}");
$ok=HotKeySet("{SPACE}");
Return;
EndFunc
Func CloseTranslationWindow()
$timeToCloseWindow=0;
;ConsoleWrite (@CRLF & "Closing" & @CRLF);
;———————————–Exit 0 ; ————————————————-
EndFunc
func setLanguageSpanish()
$destLanguage=$TARGET_LANGUAGE_SPANISH
TraySetToolTip("Translating to Spanish")
EndFunc
func setLanguageEnglish()
$destLanguage=$TARGET_LANGUAGE_ENGLISH
TraySetToolTip("Translating to English")
EndFunc
Func Terminate()
Exit 0
EndFunc
מאד נהניתי מהאתר .
אנא הסבר לי כיצד אני יכול לבדוק אם המייל שלי נפרץ או לא ע"י הקרים
תודה