phpdoc blocks and lowercasing html elements
[squirrelmail.git] / plugins / translate / options.php
CommitLineData
849bdf42 1<?php
849bdf42 2
8d6a115b 3/**
4 * options.php
5 *
82d304a0 6 * Copyright (c) 1999-2004 The SquirrelMail Project Team
8d6a115b 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 *
87392775 11 * @version $Id$
ea5f4b8e 12 * @package plugins
13 * @subpackage translate
8d6a115b 14 */
aa7fb30c 15
ea5f4b8e 16/**
17 * Path for SquirrelMail required files.
18 * @ignore
19 */
92219031 20define('SM_PATH','../../');
8d6a115b 21
22/* SquirrelMail required files. */
23require_once(SM_PATH . 'include/validate.php');
24require_once(SM_PATH . 'functions/strings.php');
25require_once(SM_PATH . 'functions/page_header.php');
26require_once(SM_PATH . 'functions/display_messages.php');
27require_once(SM_PATH . 'functions/imap.php');
8d6a115b 28require_once(SM_PATH . 'include/load_prefs.php');
29
87392775 30displayPageHeader($color, 'None');
31
32if (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');
e38ebf4d 37 }
38
87392775 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');
e38ebf4d 43 }
87392775 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', '');
e38ebf4d 49 }
849bdf42 50
87392775 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 }
38a7b6a0 56
87392775 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}
38a7b6a0 63
87392775 64$translate_server = getPref($data_dir, $username, 'translate_server');
65if ($translate_server == '') {
66 $translate_server = 'babelfish';
67}
68$translate_location = getPref($data_dir, $username, 'translate_location');
69if ($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 * FIXME: undocumented function
78 * @access private
79 */
80function ShowOption($Var, $value, $Desc) {
81 $Var = 'translate_' . $Var;
82
83 global $$Var;
84
85 echo '<option value="' . $value . '"';
86 if ($$Var == $value) {
87 echo ' selected';
849bdf42 88 }
87392775 89 echo '>' . $Desc . "</option>\n";
90}
38a7b6a0 91
87392775 92/**
93 * FIXME: undocumented function
94 * @access private
95 */
96function ShowTrad( $tit, $com, $url ) {
38a7b6a0 97
87392775 98 echo "<li><b>$tit</b> - ".
99 $com .
100 "[ <a href=\"$url\" target=\"_blank\">$tit</a> ]</li>";
38a7b6a0 101
87392775 102}
849bdf42 103
104?>
87392775 105 <table width="95%" align="center" border=0 cellpadding=1 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
38a7b6a0 106 <center><b><?php echo _("Options") . ' - '. _("Translator"); ?></b></center>
849bdf42 107 </td></tr></table>
108
04f6008a 109 <?php if (isset($_POST['submit_translate']) && $_POST['submit_translate'] ) {
110 print "<center><h4>"._("Saved Translation Options")."</h4></center>\n";
111 }?>
112
38a7b6a0 113 <p><?php echo _("Your server options are as follows:"); ?></p>
849bdf42 114
38a7b6a0 115 <ul>
116<?php
117 ShowTrad( 'Babelfish',
b0abf4b1 118 _("Maximum of 1000 characters translated, powered by Systran").
ea526024 119 "<br />".sprintf(_("Number of supported language pairs: %s"),"19")." " ,
38a7b6a0 120 'http://babelfish.altavista.com/' );
90dbea5c 121// ShowTrad( 'Translator.Go.com',
122// _("10 language pairs, maximum of 25 kilobytes translated, powered by Systran"),
123// 'http://translator.go.com/' );
38a7b6a0 124 ShowTrad( 'Dictionary.com',
b0abf4b1 125 _("No known limits, powered by Systran").
ea526024 126 "<br />".sprintf(_("Number of supported language pairs: %s"),"24")." " ,
38a7b6a0 127 'http://www.dictionary.com/translate' );
df7b27c1 128 ShowTrad( 'Google Translate',
129 _("No known limits, powered by Systran").
ea526024 130 "<br />".sprintf(_("Number of supported language pairs: %s"),"12")." " ,
df7b27c1 131 'http://www.google.com/translate' );
38a7b6a0 132 ShowTrad( 'GPLTrans',
b0abf4b1 133 _("No known limits, powered by GPLTrans (free, open source)").
ea526024 134 "<br />".sprintf(_("Number of supported language pairs: %s"),"16")." " ,
38a7b6a0 135 'http://www.translator.cx/' );
df7b27c1 136 ShowTrad( 'InterTran',
137 _("No known limits, powered by Translation Experts's InterTran").
ea526024 138 "<br />".sprintf(_("Number of supported languages: %s"),"29")." " ,
df7b27c1 139 'http://www.tranexp.com/' );
eaf943d2 140 ShowTrad( 'OTEnet',
b0abf4b1 141 _("Hellenic translations, no known limits, powered by Systran").
ea526024 142 "<br />".sprintf(_("Number of supported language pairs: %s"),"20")." " ,
eaf943d2 143 'http://systran.otenet.gr/' );
b0abf4b1 144 ShowTrad( 'PROMT',
145 _("Russian translations, maximum of 500 characters translated").
ea526024 146 "<br />".sprintf(_("Number of supported language pairs: %s"),"13")." " ,
b0abf4b1 147 'http://www.translate.ru/' );
38a7b6a0 148?>
849bdf42 149 </ul>
38a7b6a0 150 <p>
151<?php
e38ebf4d 152 echo _("You also decide if you want the translation box displayed, and where it will be located.") .
153 "<form action=\"$PHP_SELF\" method=post>".
154 '<table border=0 cellpadding=0 cellspacing=2>'.
87392775 155 '<tr><td align="right" nowrap>' .
e38ebf4d 156 _("Select your translator:") .
157 '</td>'.
158 '<td><select name="translate_translate_server">';
159
849bdf42 160 ShowOption('server', 'babelfish', 'Babelfish');
90dbea5c 161// ShowOption('server', 'go', 'Go.com');
849bdf42 162 ShowOption('server', 'dictionary', 'Dictionary.com');
df7b27c1 163 ShowOption('server', 'google', 'Google Translate');
164 ShowOption('server', 'gpltrans', 'GPLTrans');
165 ShowOption('server', 'intertran', 'Intertran');
166 ShowOption('server', 'otenet', 'OTEnet');
b0abf4b1 167 ShowOption('server', 'promt', 'PROMT');
38a7b6a0 168 echo '</select>' .
169 '</td></tr>' .
df7b27c1 170 '<tr>'.html_tag('td',_("When reading:"),'right','','nowrap').
87392775 171 '<td><input type="checkbox" name="translate_translate_show_read"';
38a7b6a0 172 if ($translate_show_read)
87392775 173 echo " checked";
174 echo ' /> - ' . _("Show translation box") .
38a7b6a0 175 ' <select name="translate_translate_location">';
176 ShowOption('location', 'left', _("to the left"));
177 ShowOption('location', 'center', _("in the center"));
178 ShowOption('location', 'right', _("to the right"));
87392775 179 echo '</select><br />'.
180 '<input type="checkbox" name="translate_translate_same_window"';
38a7b6a0 181 if ($translate_same_window)
87392775 182 echo " checked";
183 echo ' /> - ' . _("Translate inside the SquirrelMail frames").
ea526024 184 "</td></tr>\n";
185
186$disable_compose_translate=true;
187if (!$disable_compose_translate) {
188 echo '<tr>'.html_tag('td',_("When composing:"),'right','','nowrap').
38a7b6a0 189 '<td><input type=checkbox name="translate_translate_show_send"';
849bdf42 190 if ($translate_show_send)
87392775 191 echo " checked";
192 echo ' /> - ' . _("Not yet functional, currently does nothing") .
ea526024 193 "</td></tr>\n";
194}
195 echo '<tr><td></td><td>'.
38a7b6a0 196 '<input type="submit" value="' . _("Submit") . '" name="submit_translate">'.
197 '</td></tr>'.
198 '</table>'.
dcc1cc82 199 '</form>'.
200"</body></html>\n";
e38ebf4d 201
87392775 202?>