X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Ftranslate%2Fsetup.php;h=927831ae58b1ad59f44a676e95269e03e9ee264b;hp=784acf9ce88bb3c2b93d208d85e01560dbc19f1b;hb=008ca1ad42c9618ae3b6f65bc30eca766930ef19;hpb=76911253eb850bacde3d86c8cb7b4af072e67ebe diff --git a/plugins/translate/setup.php b/plugins/translate/setup.php index 784acf9c..927831ae 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") . '
'); @@ -156,7 +169,7 @@ function translate_does_it_match_language($test) { return $true; } - while ($test[$index]) { + while (isset($test[$index]) && $test[$index]) { if ($test[$index] == '*') { return $true; } @@ -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'); ?> - - + + '; printf( _("%s to %s"), $left, $right ); @@ -409,10 +448,7 @@ function translate_form_intertran($message) { function translate_form_gpltrans($message) { translate_new_form('http://www.translator.cx/cgi-bin/gplTrans'); - echo ''. translate_lang_opt('nl', 'nl', 'dutch_dict', _("Dutch")). translate_lang_opt('fr', 'fr', 'french_dict', _("French")). translate_lang_opt('de', 'de', 'german_dict', _("German")). @@ -421,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 "". + "". '