From 03c13808bc5ee8f436c1998bbf3418877d731c4f Mon Sep 17 00:00:00 2001 From: tokul Date: Sun, 2 Feb 2003 09:36:24 +0000 Subject: [PATCH] fixed missing $body and added changes of translation engines git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4490 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- plugins/translate/setup.php | 77 ++++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 19 deletions(-) diff --git a/plugins/translate/setup.php b/plugins/translate/setup.php index 281f53b7..7223302f 100644 --- a/plugins/translate/setup.php +++ b/plugins/translate/setup.php @@ -45,15 +45,28 @@ function squirrelmail_plugin_init_translate() { /* Show the translation for a message you're reading */ function translate_read_form() { global $color, $translate_server; - global $body, $translate_dir; + global $message, $translate_dir; global $translate_show_read; + global $imapConnection, $wrap_at, $passed_id, $mailbox; if (!$translate_show_read) { return; } $translate_dir = 'to'; - + +$trans_ar = $message->findDisplayEntity(array(), array('text/plain')); +$body = ''; +if ($trans_ar[0] != '') { + for ($i = 0; $i < count($trans_ar); $i++) { + $body .= formatBody($imapConnection, $message, $color, $wrap_at, $trans_ar[$i], $passed_id, $mailbox); + } + $hookResults = do_hook('message_body', $body); + $body = $hookResults[1]; + } else { + $body = 'Message can\'t be translated'; +} + $new_body = $body; $pos = strpos($new_body, '">'. _("Download this as a file") . '
'); @@ -219,14 +232,18 @@ function translate_new_form($action) { } function translate_form_babelfish($message) { - translate_new_form('http://babelfish.altavista.com/translate.dyn'); + translate_new_form('http://babelfish.altavista.com/babelfish/tr'); ?> - - + + '. translate_lang_opt('nl', 'nl', 'dutch_dict', _("Dutch")). translate_lang_opt('fr', 'fr', 'french_dict', _("French")). translate_lang_opt('de', 'de', 'german_dict', _("German")). @@ -423,23 +457,28 @@ function translate_form_gpltrans($message) { translate_lang_opt('', '', 'latin_dict', _("Latin")). translate_lang_opt('pt', 'pt', 'portuguese_dict', _("Portuguese")). translate_lang_opt('es', 'es', 'spanish_dict', _("Spanish")). - ''. - "". + ''; + echo ''; + echo "". 'GPLTrans: '; translate_table_end(); } function translate_form_dictionary($message) { - translate_new_form('http://translate.dictionary.com:8800/systran/cgi'); - echo ''. - "". + translate_new_form('http://dictionary.reference.com/translate/text.html'); + list($usec, $sec) = explode(" ",microtime()); + $time = $sec . (float)$usec*100000000; + echo "". + "". '