74db0b338e5d42bacc6de0ea988c98283aca623d
[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 /* Path for SquirrelMail required files. */
14 chdir('..');
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 . 'functions/i18n.php');
25 require_once(SM_PATH . 'include/load_prefs.php');
26 displayPageHeader($color, 'None');
27
28 if (isset($submit_translate) && $submit_translate ) {
29 if (isset($translate_translate_server)) {
30 setPref($data_dir, $username, 'translate_server', $translate_translate_server);
31 } else {
32 setPref($data_dir, $username, 'translate_server', 'babelfish');
33 }
34
35 if (isset($translate_translate_location)) {
36 setPref($data_dir, $username, 'translate_location', $translate_translate_location);
37 } else {
38 setPref($data_dir, $username, 'translate_location', 'center');
39 }
40
41 if (isset($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($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($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 <p><?php echo _("Your server options are as follows:"); ?></p>
101
102 <ul>
103 <?php
104 ShowTrad( 'Babelfish',
105 _("13 language pairs, maximum of 1000 characters translated, powered by Systran"),
106 'http://babelfish.altavista.com/' );
107 ShowTrad( 'Translator.Go.com',
108 _("10 language pairs, maximum of 25 kilobytes translated, powered by Systran"),
109 'http://translator.go.com/' );
110 ShowTrad( 'Dictionary.com',
111 _("12 language pairs, no known limits, powered by Systran"),
112 'http://www.dictionary.com/translate' );
113 ShowTrad( 'InterTran',
114 _("767 language pairs, no known limits, powered by Translation Experts's InterTran"),
115 'http://www.tranexp.com/' );
116 ShowTrad( 'GPLTrans',
117 _("8 language pairs, no known limits, powered by GPLTrans (free, open source)"),
118 'http://www.translator.cx/' );
119 ?>
120 </ul>
121 <p>
122 <?php
123 echo _("You also decide if you want the translation box displayed, and where it will be located.") .
124 "<form action=\"$PHP_SELF\" method=post>".
125 '<table border=0 cellpadding=0 cellspacing=2>'.
126 '<tr><td align=right nowrap>' .
127 _("Select your translator:") .
128 '</td>'.
129 '<td><select name="translate_translate_server">';
130
131 ShowOption('server', 'babelfish', 'Babelfish');
132 ShowOption('server', 'go', 'Go.com');
133 ShowOption('server', 'dictionary', 'Dictionary.com');
134 ShowOption('server', 'intertran', 'Intertran');
135 ShowOption('server', 'gpltrans', 'GPLTrans');
136 echo '</select>' .
137 '</td></tr>' .
138 '<tr><td align=right nowrap>' .
139 _("When reading:") .
140 '</td>'.
141 '<td><input type=checkbox name="translate_translate_show_read"';
142 if ($translate_show_read)
143 echo " CHECKED";
144 echo '> - ' . _("Show translation box") .
145 ' <select name="translate_translate_location">';
146 ShowOption('location', 'left', _("to the left"));
147 ShowOption('location', 'center', _("in the center"));
148 ShowOption('location', 'right', _("to the right"));
149 echo '</select><br>'.
150 '<input type=checkbox name="translate_translate_same_window"';
151 if ($translate_same_window)
152 echo " CHECKED";
153 echo '> - ' . _("Translate inside the SquirrelMail frames").
154 '</td></tr>'.
155 '<tr><td align=right nowrap>'.
156 _("When composing:") . '</td>'.
157 '<td><input type=checkbox name="translate_translate_show_send"';
158 if ($translate_show_send)
159 echo " CHECKED";
160 echo '> - ' . _("Not yet functional, currently does nothing") .
161 '</td></tr>'.
162 '<tr><td></td><td>'.
163 '<input type="submit" value="' . _("Submit") . '" name="submit_translate">'.
164 '</td></tr>'.
165 '</table>'.
166 '</form>'.
167 "</body></html>\n";
168
169 ?>