X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=inline;f=plugins%2Ftranslate%2Fsetup.php;h=af6f7204c840a18c89083dc0d1a849493f9abd32;hb=ea5f4b8eaf805c4cc4e9533e87d057300a7fe666;hp=f33cc19755bf0509fdd692fac26703ddbeb14949;hpb=849bdf42ed7bd7cca68909d2b46869742dfd210e;p=squirrelmail.git
diff --git a/plugins/translate/setup.php b/plugins/translate/setup.php
index f33cc197..af6f7204 100644
--- a/plugins/translate/setup.php
+++ b/plugins/translate/setup.php
@@ -1,5 +1,16 @@
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
');
+ '">'. _("Download this as a file") . '
');
if (is_int($pos)) {
$new_body = substr($new_body, 0, $pos);
}
-
- $trans = get_html_translation_table('HTMLENTITIES');
+
+ $trans = get_html_translation_table(HTML_ENTITIES);
$trans[' '] = ' ';
$trans = array_flip($trans);
$new_body = strtr($new_body, $trans);
@@ -90,60 +116,16 @@ function translate_button() {
}
-function translate_opt() {
- global $optionpages;
- $optionpages[] = array(
- 'name' => 'Translation Options',
+function translate_optpage_register_block() {
+ global $optpage_blocks;
+ $optpage_blocks[] = array(
+ 'name' => _("Translation Options"),
'url' => '../plugins/translate/options.php',
- 'desc' => 'Which translator should be used when you get messages in a different language?',
+ 'desc' => _("Which translator should be used when you get messages in a different language?"),
'js' => false
);
}
-function translate_sav() {
- global $username,$data_dir;
- global $submit_translate, $translate_translate_server;
- global $translate_translate_location;
- global $translate_translate_show_read;
- global $translate_translate_show_send;
- global $translate_translate_same_window;
-
- if ($submit_translate) {
- if (isset($translate_translate_server)) {
- setPref($data_dir, $username, 'translate_server', $translate_translate_server);
- } else {
- setPref($data_dir, $username, 'translate_server', 'babelfish');
- }
-
- if (isset($translate_translate_location)) {
- setPref($data_dir, $username, 'translate_location', $translate_translate_location);
- } else {
- setPref($data_dir, $username, 'translate_location', 'center');
- }
-
- if (isset($translate_translate_show_read)) {
- setPref($data_dir, $username, 'translate_show_read', '1');
- } else {
- setPref($data_dir, $username, 'translate_show_read', '');
- }
-
- if (isset($translate_translate_show_send)) {
- setPref($data_dir, $username, 'translate_show_send', '1');
- } else {
- setPref($data_dir, $username, 'translate_show_send', '');
- }
-
- if (isset($translate_translate_same_window)) {
- setPref($data_dir, $username, 'translate_same_window', '1');
- } else {
- setPref($data_dir, $username, 'translate_same_window', '');
- }
-
- echo '
Translation options saved.';
- }
-}
-
-
function translate_pref() {
global $username, $data_dir;
global $translate_server, $translate_location;
@@ -192,7 +174,7 @@ function translate_does_it_match_language($test) {
return $true;
}
- while ($test[$index]) {
+ while (isset($test[$index]) && $test[$index]) {
if ($test[$index] == '*') {
return $true;
}
@@ -209,18 +191,20 @@ function translate_does_it_match_language($test) {
function translate_lang_opt($from, $to, $value, $text) {
global $translate_dir;
-
- echo ' \n";
+
+ $ret .= '>' . $text . "\n";
+
+ return( $ret );
}
@@ -241,7 +225,7 @@ function translate_new_form($action) {
if (!$translate_same_window) {
echo ' target="_blank"';
}
-
+
echo ">\n";
?>>
@@ -253,29 +237,92 @@ 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');
?>
-
-
+
+
- Babelfish:
-'.
+ 'Babelfish: ';
+
translate_table_end();
}
@@ -284,133 +331,369 @@ function translate_form_go($message) {
?>
-
- Go.com:
-'.
+ "".
+ 'Go.com: ';
+
translate_table_end();
}
function translate_form_intertran($message) {
translate_new_form('http://www.tranexp.com:2000/InterTran');
-?>
-
-
-
- to
- InterTran:
-'.
+ ''.
+ "";
+
+ $left = '';
+
+ $right = '';
+ printf( _("%s to %s"), $left, $right );
+ echo 'InterTran: ';
+
translate_table_end();
}
function translate_form_gpltrans($message) {
translate_new_form('http://www.translator.cx/cgi-bin/gplTrans');
-?>
-
- GPLTrans:
-'.
+ translate_lang_opt('nl', 'nl', 'dutch_dict', _("Dutch")).
+ translate_lang_opt('fr', 'fr', 'french_dict', _("French")).
+ translate_lang_opt('de', 'de', 'german_dict', _("German")).
+ translate_lang_opt('', '', 'indonesian_dict', _("Indonesian")).
+ translate_lang_opt('it', 'it', 'italian_dict', _("Italian")).
+ 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');
-?>
-
-
- Dictionary.com:
-".
+ "".
+ ''.
+ 'Dictionary.com: ';
+
translate_table_end();
}
+
+function translate_form_otenet($message) {
+ translate_new_form('http://systran.otenet.gr/cgi-bin/systran.cgi');
+?>
+
+
+
+