Better error messages: for some reason, the strings weren't used to report the error?
[squirrelmail.git] / plugins / translate / options.php
1 <?php
2 /**
3 * options.php
4 *
5 * Copyright (c) 1999-2002 The SquirrelMail Project Team
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
7 *
8 * Pick your translator to translate the body of incoming mail messages
9 *
10 * $Id$
11 */
12
13 chdir('..');
14 require_once('../src/validate.php');
15 require_once('../functions/strings.php');
16 require_once('../functions/page_header.php');
17 require_once('../functions/display_messages.php');
18 require_once('../functions/imap.php');
19 require_once('../functions/array.php');
20 require_once('../functions/i18n.php');
21 require_once('../src/load_prefs.php');
22 displayPageHeader($color, 'None');
23
24 if (isset($submit_translate) && $submit_translate ) {
25 if (isset($translate_translate_server)) {
26 setPref($data_dir, $username, 'translate_server', $translate_translate_server);
27 } else {
28 setPref($data_dir, $username, 'translate_server', 'babelfish');
29 }
30
31 if (isset($translate_translate_location)) {
32 setPref($data_dir, $username, 'translate_location', $translate_translate_location);
33 } else {
34 setPref($data_dir, $username, 'translate_location', 'center');
35 }
36
37 if (isset($translate_translate_show_read)) {
38 setPref($data_dir, $username, 'translate_show_read', '1');
39 } else {
40 setPref($data_dir, $username, 'translate_show_read', '');
41 }
42
43 if (isset($translate_translate_show_send)) {
44 setPref($data_dir, $username, 'translate_show_send', '1');
45 } else {
46 setPref($data_dir, $username, 'translate_show_send', '');
47 }
48
49 if (isset($translate_translate_same_window)) {
50 setPref($data_dir, $username, 'translate_same_window', '1');
51 } else {
52 setPref($data_dir, $username, 'translate_same_window', '');
53 }
54 }
55
56 $translate_server = getPref($data_dir, $username, 'translate_server');
57 if ($translate_server == '') {
58 $translate_server = 'babelfish';
59 }
60 $translate_location = getPref($data_dir, $username, 'translate_location');
61 if ($translate_location == '') {
62 $translate_location = 'center';
63 }
64 $translate_show_read = getPref($data_dir, $username, 'translate_show_read');
65 $translate_show_send = getPref($data_dir, $username, 'translate_show_send');
66 $translate_same_window = getPref($data_dir, $username, 'translate_same_window');
67
68
69 function ShowOption($Var, $value, $Desc)
70 {
71 $Var = 'translate_' . $Var;
72
73 global $$Var;
74
75 echo '<option value="' . $value . '"';
76 if ($$Var == $value)
77 {
78 echo ' SELECTED';
79 }
80 echo '>' . $Desc . "</option>\n";
81 }
82
83 function ShowTrad( $tit, $com, $url ) {
84
85 echo "<li><b>$tit</b> - ".
86 $com .
87 "[ <a href=\"$url\" target=\"_blank\">$tit</a> ]</li>";
88
89 }
90
91 ?>
92 <table width="95%" align=center border=0 cellpadding=1 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
93 <center><b><?php echo _("Options") . ' - '. _("Translator"); ?></b></center>
94 </td></tr></table>
95
96 <p><?php echo _("Your server options are as follows:"); ?></p>
97
98 <ul>
99 <?php
100 ShowTrad( 'Babelfish',
101 _("13 language pairs, maximum of 1000 characters translated, powered by Systran"),
102 'http://babelfish.altavista.com/' );
103 ShowTrad( 'Translator.Go.com',
104 _("10 language pairs, maximum of 25 kilobytes translated, powered by Systran"),
105 'http://translator.go.com/' );
106 ShowTrad( 'Dictionary.com',
107 _("12 language pairs, no known limits, powered by Systran"),
108 'http://www.dictionary.com/translate' );
109 ShowTrad( 'InterTran',
110 _("767 language pairs, no known limits, powered by Translation Experts's InterTran"),
111 'http://www.tranexp.com/' );
112 ShowTrad( 'GPLTrans',
113 _("8 language pairs, no known limits, powered by GPLTrans (free, open source)"),
114 'http://www.translator.cx/' );
115 ?>
116 </ul>
117 <p>
118 <?php
119 echo _("You also decide if you want the translation box displayed, and where it will be located.") .
120 "<form action=\"$PHP_SELF\" method=post>".
121 '<table border=0 cellpadding=0 cellspacing=2>'.
122 '<tr><td align=right nowrap>' .
123 _("Select your translator:") .
124 '</td>'.
125 '<td><select name="translate_translate_server">';
126
127 ShowOption('server', 'babelfish', 'Babelfish');
128 ShowOption('server', 'go', 'Go.com');
129 ShowOption('server', 'dictionary', 'Dictionary.com');
130 ShowOption('server', 'intertran', 'Intertran');
131 ShowOption('server', 'gpltrans', 'GPLTrans');
132 echo '</select>' .
133 '</td></tr>' .
134 '<tr><td align=right nowrap>' .
135 _("When reading:") .
136 '</td>'.
137 '<td><input type=checkbox name="translate_translate_show_read"';
138 if ($translate_show_read)
139 echo " CHECKED";
140 echo '> - ' . _("Show translation box") .
141 ' <select name="translate_translate_location">';
142 ShowOption('location', 'left', _("to the left"));
143 ShowOption('location', 'center', _("in the center"));
144 ShowOption('location', 'right', _("to the right"));
145 echo '</select><br>'.
146 '<input type=checkbox name="translate_translate_same_window"';
147 if ($translate_same_window)
148 echo " CHECKED";
149 echo '> - ' . _("Translate inside the SquirrelMail frames").
150 '</td></tr>'.
151 '<tr><td align=right nowrap>'.
152 _("When composing:") . '</td>'.
153 '<td><input type=checkbox name="translate_translate_show_send"';
154 if ($translate_show_send)
155 echo " CHECKED";
156 echo '> - ' . _("Not yet functional, currently does nothing") .
157 '</td></tr>'.
158 '<tr><td></td><td>'.
159 '<input type="submit" value="' . _("Submit") . '" name="submit_translate">'.
160 '</td></tr>'.
161 '</table>'.
162 '</form>'.
163 "</body></html>\n";
164
165 ?>