I18n fixes
[squirrelmail.git] / plugins / translate / options.php
... / ...
CommitLineData
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 * @version $Id$
12 * @package plugins
13 * @subpackage translate
14 */
15
16/**
17 * Path for SquirrelMail required files.
18 * @ignore
19 */
20define('SM_PATH','../../');
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');
28require_once(SM_PATH . 'include/load_prefs.php');
29
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');
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');
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';
88 }
89 echo '>' . $Desc . "</option>\n";
90}
91
92/**
93 * FIXME: undocumented function
94 * @access private
95 */
96function ShowTrad( $tit, $com, $url ) {
97
98 echo "<li><b>$tit</b> - ".
99 $com .
100 "[ <a href=\"$url\" target=\"_blank\">$tit</a> ]</li>";
101
102}
103
104?>
105 <table width="95%" align="center" border=0 cellpadding=1 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
106 <center><b><?php echo _("Options") . ' - '. _("Translator"); ?></b></center>
107 </td></tr></table>
108
109 <?php if (isset($_POST['submit_translate']) && $_POST['submit_translate'] ) {
110 print "<center><h4>"._("Saved Translation Options")."</h4></center>\n";
111 }?>
112
113 <p><?php echo _("Your server options are as follows:"); ?></p>
114
115 <ul>
116<?php
117 ShowTrad( 'Babelfish',
118 _("Maximum of 1000 characters translated, powered by Systran").
119 "<br />".sprintf(_("Number of supported language pairs: %s"),"19")." " ,
120 'http://babelfish.altavista.com/' );
121// ShowTrad( 'Translator.Go.com',
122// _("10 language pairs, maximum of 25 kilobytes translated, powered by Systran"),
123// 'http://translator.go.com/' );
124 ShowTrad( 'Dictionary.com',
125 _("No known limits, powered by Systran").
126 "<br />".sprintf(_("Number of supported language pairs: %s"),"24")." " ,
127 'http://www.dictionary.com/translate' );
128 ShowTrad( 'Google Translate',
129 _("No known limits, powered by Systran").
130 "<br />".sprintf(_("Number of supported language pairs: %s"),"12")." " ,
131 'http://www.google.com/translate' );
132 ShowTrad( 'GPLTrans',
133 _("No known limits, powered by GPLTrans (free, open source)").
134 "<br />".sprintf(_("Number of supported language pairs: %s"),"16")." " ,
135 'http://www.translator.cx/' );
136 ShowTrad( 'InterTran',
137 _("No known limits, powered by Translation Experts' InterTran").
138 "<br />".sprintf(_("Number of supported languages: %s"),"29")." " ,
139 'http://www.tranexp.com/' );
140 ShowTrad( 'OTEnet',
141 _("Hellenic translations, no known limits, powered by Systran").
142 "<br />".sprintf(_("Number of supported language pairs: %s"),"20")." " ,
143 'http://systran.otenet.gr/' );
144 ShowTrad( 'PROMT',
145 _("Russian translations, maximum of 500 characters translated").
146 "<br />".sprintf(_("Number of supported language pairs: %s"),"13")." " ,
147 'http://www.online-translator.com/' );
148?>
149 </ul>
150 <p>
151<?php
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>'.
155 '<tr><td align="right" nowrap>' .
156 _("Select your translator:") .
157 '</td>'.
158 '<td><select name="translate_translate_server">';
159
160 ShowOption('server', 'babelfish', 'Babelfish');
161// ShowOption('server', 'go', 'Go.com');
162 ShowOption('server', 'dictionary', 'Dictionary.com');
163 ShowOption('server', 'google', 'Google Translate');
164 ShowOption('server', 'gpltrans', 'GPLTrans');
165 ShowOption('server', 'intertran', 'Intertran');
166 ShowOption('server', 'otenet', 'OTEnet');
167 ShowOption('server', 'promt', 'PROMT');
168 echo '</select>' .
169 '</td></tr>' .
170 '<tr>'.html_tag('td',_("When reading:"),'right','','nowrap').
171 '<td><input type="checkbox" name="translate_translate_show_read"';
172 if ($translate_show_read)
173 echo " checked";
174 echo ' /> - ' . _("Show translation box") .
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"));
179 echo '</select><br />'.
180 '<input type="checkbox" name="translate_translate_same_window"';
181 if ($translate_same_window)
182 echo " checked";
183 echo ' /> - ' . _("Translate inside the SquirrelMail frames").
184 "</td></tr>\n";
185
186$disable_compose_translate=true;
187if (!$disable_compose_translate) {
188 echo '<tr>'.html_tag('td',_("When composing:"),'right','','nowrap').
189 '<td><input type=checkbox name="translate_translate_show_send"';
190 if ($translate_show_send)
191 echo " checked";
192 echo ' /> - ' . _("Not yet functional, currently does nothing") .
193 "</td></tr>\n";
194}
195 echo '<tr><td></td><td>'.
196 '<input type="submit" value="' . _("Submit") . '" name="submit_translate">'.
197 '</td></tr>'.
198 '</table>'.
199 '</form>'.
200"</body></html>\n";
201
202?>