Making log entries in the ChangeLog.
[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
15 session_start();
16
17 require_once('../config/config.php');
18 require_once('../functions/strings.php');
19 require_once('../functions/page_header.php');
20 require_once('../functions/display_messages.php');
21 require_once('../functions/imap.php');
22 require_once('../functions/array.php');
23 require_once('../functions/i18n.php');
24 require_once('../src/load_prefs.php');
25 displayPageHeader($color, 'None');
26
27 if ($submit_translate) {
28 if (isset($translate_translate_server)) {
29 setPref($data_dir, $username, 'translate_server', $translate_translate_server);
30 } else {
31 setPref($data_dir, $username, 'translate_server', 'babelfish');
32 }
33
34 if (isset($translate_translate_location)) {
35 setPref($data_dir, $username, 'translate_location', $translate_translate_location);
36 } else {
37 setPref($data_dir, $username, 'translate_location', 'center');
38 }
39
40 if (isset($translate_translate_show_read)) {
41 setPref($data_dir, $username, 'translate_show_read', '1');
42 } else {
43 setPref($data_dir, $username, 'translate_show_read', '');
44 }
45
46 if (isset($translate_translate_show_send)) {
47 setPref($data_dir, $username, 'translate_show_send', '1');
48 } else {
49 setPref($data_dir, $username, 'translate_show_send', '');
50 }
51
52 if (isset($translate_translate_same_window)) {
53 setPref($data_dir, $username, 'translate_same_window', '1');
54 } else {
55 setPref($data_dir, $username, 'translate_same_window', '');
56 }
57 }
58
59 $translate_server = getPref($data_dir, $username, 'translate_server');
60 if ($translate_server == '') {
61 $translate_server = 'babelfish';
62 }
63 $translate_location = getPref($data_dir, $username, 'translate_location');
64 if ($translate_location == '') {
65 $translate_location = 'center';
66 }
67 $translate_show_read = getPref($data_dir, $username, 'translate_show_read');
68 $translate_show_send = getPref($data_dir, $username, 'translate_show_send');
69 $translate_same_window = getPref($data_dir, $username, 'translate_same_window');
70
71
72 function ShowOption($Var, $value, $Desc)
73 {
74 $Var = 'translate_' . $Var;
75
76 global $$Var;
77
78 echo '<option value="' . $value . '"';
79 if ($$Var == $value)
80 {
81 echo ' SELECTED';
82 }
83 echo '>' . $Desc . "</option>\n";
84 }
85
86 function ShowTrad( $tit, $com, $url ) {
87
88 echo "<li><b>$tit</b> - ".
89 $com .
90 "[ <a href=\"$url\" target=\"_blank\">$tit</a> ]</li>";
91
92 }
93
94 ?>
95 <br>
96 <table width=100% align=center border=0 cellpadding=2 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 ?>