adding phpdoc block
[squirrelmail.git] / plugins / translate / options.php
1 <?php
2
3 /**
4 * options.php
5 *
6 * Copyright (c) 1999-2004 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * Pick your translator to translate the body of incoming mail messages
10 *
11 * $Id$
12 * @package plugins
13 * @subpackage translate
14 */
15
16 /**
17 * Path for SquirrelMail required files.
18 * @ignore
19 */
20 define('SM_PATH','../../');
21
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');
29
30 displayPageHeader($color, 'None');
31
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']);
35 } else {
36 setPref($data_dir, $username, 'translate_server', 'babelfish');
37 }
38
39 if (isset($_POST['translate_translate_location'])) {
40 setPref($data_dir, $username, 'translate_location', $_POST['translate_translate_location']);
41 } else {
42 setPref($data_dir, $username, 'translate_location', 'center');
43 }
44
45 if (isset($_POST['translate_translate_show_read'])) {
46 setPref($data_dir, $username, 'translate_show_read', '1');
47 } else {
48 setPref($data_dir, $username, 'translate_show_read', '');
49 }
50
51 if (isset($_POST['translate_translate_show_send'])) {
52 setPref($data_dir, $username, 'translate_show_send', '1');
53 } else {
54 setPref($data_dir, $username, 'translate_show_send', '');
55 }
56
57 if (isset($_POST['translate_translate_same_window'])) {
58 setPref($data_dir, $username, 'translate_same_window', '1');
59 } else {
60 setPref($data_dir, $username, 'translate_same_window', '');
61 }
62 }
63
64 $translate_server = getPref($data_dir, $username, 'translate_server');
65 if ($translate_server == '') {
66 $translate_server = 'babelfish';
67 }
68 $translate_location = getPref($data_dir, $username, 'translate_location');
69 if ($translate_location == '') {
70 $translate_location = 'center';
71 }
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');
75
76
77 function ShowOption($Var, $value, $Desc)
78 {
79 $Var = 'translate_' . $Var;
80
81 global $$Var;
82
83 echo '<option value="' . $value . '"';
84 if ($$Var == $value)
85 {
86 echo ' SELECTED';
87 }
88 echo '>' . $Desc . "</option>\n";
89 }
90
91 function ShowTrad( $tit, $com, $url ) {
92
93 echo "<li><b>$tit</b> - ".
94 $com .
95 "[ <a href=\"$url\" target=\"_blank\">$tit</a> ]</li>";
96
97 }
98
99 ?>
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>
102 </td></tr></table>
103
104 <?php if (isset($_POST['submit_translate']) && $_POST['submit_translate'] ) {
105 print "<center><h4>"._("Saved Translation Options")."</h4></center>\n";
106 }?>
107
108 <p><?php echo _("Your server options are as follows:"); ?></p>
109
110 <ul>
111 <?php
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/' );
135 ShowTrad( 'OTEnet',
136 _("Hellenic translations, no known limits, powered by Systran").
137 "<br />".sprintf(_("Number of supported language pairs: %s"),"20")." " ,
138 'http://systran.otenet.gr/' );
139 ShowTrad( 'PROMT',
140 _("Russian translations, maximum of 500 characters translated").
141 "<br />".sprintf(_("Number of supported language pairs: %s"),"13")." " ,
142 'http://www.translate.ru/' );
143 ?>
144 </ul>
145 <p>
146 <?php
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:") .
152 '</td>'.
153 '<td><select name="translate_translate_server">';
154
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');
163 echo '</select>' .
164 '</td></tr>' .
165 '<tr>'.html_tag('td',_("When reading:"),'right','','nowrap').
166 '<td><input type=checkbox name="translate_translate_show_read"';
167 if ($translate_show_read)
168 echo " CHECKED";
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)
177 echo " CHECKED";
178 echo '> - ' . _("Translate inside the SquirrelMail frames").
179 "</td></tr>\n";
180
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)
186 echo " CHECKED";
187 echo '> - ' . _("Not yet functional, currently does nothing") .
188 "</td></tr>\n";
189 }
190 echo '<tr><td></td><td>'.
191 '<input type="submit" value="' . _("Submit") . '" name="submit_translate">'.
192 '</td></tr>'.
193 '</table>'.
194 '</form>'.
195 "</body></html>\n";
196
197 ?>