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