6 * Copyright (c) 1999-2003 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * Pick your translator to translate the body of incoming mail messages
13 * @subpackage translate
17 * Path for SquirrelMail required files.
20 define('SM_PATH','../../');
22 /* SquirrelMail required files. */
23 require_once(SM_PATH
. 'include/validate.php');
24 require_once(SM_PATH
. 'functions/strings.php');
25 require_once(SM_PATH
. 'functions/page_header.php');
26 require_once(SM_PATH
. 'functions/display_messages.php');
27 require_once(SM_PATH
. 'functions/imap.php');
28 require_once(SM_PATH
. 'include/load_prefs.php');
30 displayPageHeader($color, 'None');
32 if (isset($_POST['submit_translate']) && $_POST['submit_translate'] ) {
33 if (isset($_POST['translate_translate_server'])) {
34 setPref($data_dir, $username, 'translate_server', $_POST['translate_translate_server']);
36 setPref($data_dir, $username, 'translate_server', 'babelfish');
39 if (isset($_POST['translate_translate_location'])) {
40 setPref($data_dir, $username, 'translate_location', $_POST['translate_translate_location']);
42 setPref($data_dir, $username, 'translate_location', 'center');
45 if (isset($_POST['translate_translate_show_read'])) {
46 setPref($data_dir, $username, 'translate_show_read', '1');
48 setPref($data_dir, $username, 'translate_show_read', '');
51 if (isset($_POST['translate_translate_show_send'])) {
52 setPref($data_dir, $username, 'translate_show_send', '1');
54 setPref($data_dir, $username, 'translate_show_send', '');
57 if (isset($_POST['translate_translate_same_window'])) {
58 setPref($data_dir, $username, 'translate_same_window', '1');
60 setPref($data_dir, $username, 'translate_same_window', '');
64 $translate_server = getPref($data_dir, $username, 'translate_server');
65 if ($translate_server == '') {
66 $translate_server = 'babelfish';
68 $translate_location = getPref($data_dir, $username, 'translate_location');
69 if ($translate_location == '') {
70 $translate_location = 'center';
72 $translate_show_read = getPref($data_dir, $username, 'translate_show_read');
73 $translate_show_send = getPref($data_dir, $username, 'translate_show_send');
74 $translate_same_window = getPref($data_dir, $username, 'translate_same_window');
77 function ShowOption($Var, $value, $Desc)
79 $Var = 'translate_' . $Var;
83 echo '<option value="' . $value . '"';
88 echo '>' . $Desc . "</option>\n";
91 function ShowTrad( $tit, $com, $url ) {
93 echo "<li><b>$tit</b> - ".
95 "[ <a href=\"$url\" target=\"_blank\">$tit</a> ]</li>";
100 <table width
="95%" align
=center border
=0 cellpadding
=1 cellspacing
=0><tr
><td bgcolor
="<?php echo $color[0] ?>">
101 <center
><b
><?php
echo _("Options") . ' - '. _("Translator"); ?
></b
></center
>
104 <?php
if (isset($_POST['submit_translate']) && $_POST['submit_translate'] ) {
105 print "<center><h4>"._("Saved Translation Options")."</h4></center>\n";
108 <p
><?php
echo _("Your server options are as follows:"); ?
></p
>
112 ShowTrad( 'Babelfish',
113 _("Maximum of 1000 characters translated, powered by Systran").
114 "<br />".sprintf(_("Number of supported language pairs: %s"),"19")." " ,
115 'http://babelfish.altavista.com/' );
116 // ShowTrad( 'Translator.Go.com',
117 // _("10 language pairs, maximum of 25 kilobytes translated, powered by Systran"),
118 // 'http://translator.go.com/' );
119 ShowTrad( 'Dictionary.com',
120 _("No known limits, powered by Systran").
121 "<br />".sprintf(_("Number of supported language pairs: %s"),"24")." " ,
122 'http://www.dictionary.com/translate' );
123 ShowTrad( 'Google Translate',
124 _("No known limits, powered by Systran").
125 "<br />".sprintf(_("Number of supported language pairs: %s"),"12")." " ,
126 'http://www.google.com/translate' );
127 ShowTrad( 'GPLTrans',
128 _("No known limits, powered by GPLTrans (free, open source)").
129 "<br />".sprintf(_("Number of supported language pairs: %s"),"16")." " ,
130 'http://www.translator.cx/' );
131 ShowTrad( 'InterTran',
132 _("No known limits, powered by Translation Experts's InterTran").
133 "<br />".sprintf(_("Number of supported languages: %s"),"29")." " ,
134 'http://www.tranexp.com/' );
136 _("Hellenic translations, no known limits, powered by Systran").
137 "<br />".sprintf(_("Number of supported language pairs: %s"),"20")." " ,
138 'http://systran.otenet.gr/' );
140 _("Russian translations, maximum of 500 characters translated").
141 "<br />".sprintf(_("Number of supported language pairs: %s"),"13")." " ,
142 'http://www.translate.ru/' );
147 echo _("You also decide if you want the translation box displayed, and where it will be located.") .
148 "<form action=\"$PHP_SELF\" method=post>".
149 '<table border=0 cellpadding=0 cellspacing=2>'.
150 '<tr><td align=right nowrap>' .
151 _("Select your translator:") .
153 '<td><select name="translate_translate_server">';
155 ShowOption('server', 'babelfish', 'Babelfish');
156 // ShowOption('server', 'go', 'Go.com');
157 ShowOption('server', 'dictionary', 'Dictionary.com');
158 ShowOption('server', 'google', 'Google Translate');
159 ShowOption('server', 'gpltrans', 'GPLTrans');
160 ShowOption('server', 'intertran', 'Intertran');
161 ShowOption('server', 'otenet', 'OTEnet');
162 ShowOption('server', 'promt', 'PROMT');
165 '<tr>'.html_tag('td',_("When reading:"),'right','','nowrap').
166 '<td><input type=checkbox name="translate_translate_show_read"';
167 if ($translate_show_read)
169 echo '> - ' . _("Show translation box") .
170 ' <select name="translate_translate_location">';
171 ShowOption('location', 'left', _("to the left"));
172 ShowOption('location', 'center', _("in the center"));
173 ShowOption('location', 'right', _("to the right"));
174 echo '</select><br>'.
175 '<input type=checkbox name="translate_translate_same_window"';
176 if ($translate_same_window)
178 echo '> - ' . _("Translate inside the SquirrelMail frames").
181 $disable_compose_translate=true;
182 if (!$disable_compose_translate) {
183 echo '<tr>'.html_tag('td',_("When composing:"),'right','','nowrap').
184 '<td><input type=checkbox name="translate_translate_show_send"';
185 if ($translate_show_send)
187 echo '> - ' . _("Not yet functional, currently does nothing") .
190 echo '<tr><td></td><td>'.
191 '<input type="submit" value="' . _("Submit") . '" name="submit_translate">'.