From: tokul Date: Sun, 31 Jul 2005 14:19:04 +0000 (+0000) Subject: instead of retrieving text with 'Download as a file link' and removing link text... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9350f78a13676ea3b151b6a596c224efb14bc252;p=squirrelmail.git instead of retrieving text with 'Download as a file link' and removing link text later, retrieve text without Download link. add character set option to engines that don't change used character sets in their forms. Fixes translation of 8bit texts (translations from Russian, Greek, Chinese, Korean, Japanese, etc to English and other languages) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@9855 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/plugins/translate/functions.php b/plugins/translate/functions.php index edd0233a..3a91b2b9 100644 --- a/plugins/translate/functions.php +++ b/plugins/translate/functions.php @@ -94,7 +94,7 @@ function translate_read_form_function() { $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); + $body .= formatBody($imapConnection, $message, $color, $wrap_at, $trans_ar[$i], $passed_id, $mailbox, true); } $hookResults = do_hook('message_body', $body); $body = $hookResults[1]; @@ -103,11 +103,6 @@ function translate_read_form_function() { } $new_body = $body; - $pos = strpos($new_body, - '">'. _("Download this as a file") . '
'); - if (is_int($pos)) { - $new_body = substr($new_body, 0, $pos); - } $trans = get_html_translation_table(HTML_ENTITIES); $trans[' '] = ' '; @@ -424,9 +419,11 @@ function translate_lang_opt($from, $to, $value, $text) { * Starts translation box * * @param string $action url that has to recieve message for translation + * @param string $charset (since sm 1.5.1) character set, that should be used + * to submit 8bit information. * @access private */ -function translate_new_form($action) { +function translate_new_form($action,$charset=null) { global $translate_dir, $translate_location; global $color, $translate_same_window; @@ -443,6 +440,9 @@ function translate_new_form($action) { if (!$translate_same_window) { echo ' target="_blank"'; } + + if (! is_null($charset)) + echo ' accept-charset="'.htmlspecialchars($charset).'"'; echo ">\n"; @@ -461,7 +461,7 @@ function translate_new_form($action) { * @access private */ function translate_form_babelfish($message) { - translate_new_form('http://babelfish.altavista.com/babelfish/tr'); + translate_new_form('http://babelfish.altavista.com/babelfish/tr','utf-8'); ?> @@ -773,7 +773,7 @@ function translate_form_dictionary($message) { * @access private */ function translate_form_otenet($message) { - translate_new_form('http://trans.otenet.gr/systran/box'); + translate_new_form('http://trans.otenet.gr/systran/box','windows-1253'); ?> @@ -833,7 +833,7 @@ function translate_form_otenet($message) { * @access private */ function translate_form_promt($message) { - translate_new_form('http://www.online-translator.com/text.asp#tr_form'); + translate_new_form('http://www.online-translator.com/text.asp#tr_form','windows-1251'); echo ''; echo ''; echo _("Interface language")." : "; @@ -893,7 +893,7 @@ function translate_form_promt($message) { * @access private */ function translate_form_google($message) { - translate_new_form('http://www.google.com/translate_t'); + translate_new_form('http://www.google.com/translate_t','utf-8'); echo '' . '' . '' .