utf-8 is already converted by ja_JP extra functions.
[squirrelmail.git] / plugins / translate / options.php
CommitLineData
849bdf42 1<?php
849bdf42 2
8d6a115b 3/**
4 * options.php
5 *
76911253 6 * Copyright (c) 1999-2003 The SquirrelMail Project Team
8d6a115b 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 */
aa7fb30c 13
8d6a115b 14/* Path for SquirrelMail required files. */
92219031 15define('SM_PATH','../../');
8d6a115b 16
17/* SquirrelMail required files. */
18require_once(SM_PATH . 'include/validate.php');
19require_once(SM_PATH . 'functions/strings.php');
20require_once(SM_PATH . 'functions/page_header.php');
21require_once(SM_PATH . 'functions/display_messages.php');
22require_once(SM_PATH . 'functions/imap.php');
8d6a115b 23require_once(SM_PATH . 'include/load_prefs.php');
24
25 displayPageHeader($color, 'None');
849bdf42 26
04f6008a 27 if (isset($_POST['submit_translate']) && $_POST['submit_translate'] ) {
28 if (isset($_POST['translate_translate_server'])) {
29 setPref($data_dir, $username, 'translate_server', $_POST['translate_translate_server']);
e38ebf4d 30 } else {
31 setPref($data_dir, $username, 'translate_server', 'babelfish');
32 }
33
04f6008a 34 if (isset($_POST['translate_translate_location'])) {
35 setPref($data_dir, $username, 'translate_location', $_POST['translate_translate_location']);
e38ebf4d 36 } else {
37 setPref($data_dir, $username, 'translate_location', 'center');
38 }
39
04f6008a 40 if (isset($_POST['translate_translate_show_read'])) {
e38ebf4d 41 setPref($data_dir, $username, 'translate_show_read', '1');
42 } else {
43 setPref($data_dir, $username, 'translate_show_read', '');
44 }
45
04f6008a 46 if (isset($_POST['translate_translate_show_send'])) {
e38ebf4d 47 setPref($data_dir, $username, 'translate_show_send', '1');
48 } else {
49 setPref($data_dir, $username, 'translate_show_send', '');
50 }
51
04f6008a 52 if (isset($_POST['translate_translate_same_window'])) {
e38ebf4d 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 == '') {
849bdf42 61 $translate_server = 'babelfish';
e38ebf4d 62 }
63 $translate_location = getPref($data_dir, $username, 'translate_location');
64 if ($translate_location == '') {
849bdf42 65 $translate_location = 'center';
e38ebf4d 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
849bdf42 71
72 function ShowOption($Var, $value, $Desc)
73 {
74 $Var = 'translate_' . $Var;
38a7b6a0 75
849bdf42 76 global $$Var;
38a7b6a0 77
849bdf42 78 echo '<option value="' . $value . '"';
79 if ($$Var == $value)
80 {
81 echo ' SELECTED';
82 }
83 echo '>' . $Desc . "</option>\n";
84 }
38a7b6a0 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 }
849bdf42 93
94?>
6206f6c4 95 <table width="95%" align=center border=0 cellpadding=1 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
38a7b6a0 96 <center><b><?php echo _("Options") . ' - '. _("Translator"); ?></b></center>
849bdf42 97 </td></tr></table>
98
04f6008a 99 <?php if (isset($_POST['submit_translate']) && $_POST['submit_translate'] ) {
100 print "<center><h4>"._("Saved Translation Options")."</h4></center>\n";
101 }?>
102
38a7b6a0 103 <p><?php echo _("Your server options are as follows:"); ?></p>
849bdf42 104
38a7b6a0 105 <ul>
106<?php
107 ShowTrad( 'Babelfish',
b0abf4b1 108 _("Maximum of 1000 characters translated, powered by Systran").
109 "<br>".sprintf(_("Number of supported language pairs: %s"),"19")." " ,
38a7b6a0 110 'http://babelfish.altavista.com/' );
90dbea5c 111// ShowTrad( 'Translator.Go.com',
112// _("10 language pairs, maximum of 25 kilobytes translated, powered by Systran"),
113// 'http://translator.go.com/' );
38a7b6a0 114 ShowTrad( 'Dictionary.com',
b0abf4b1 115 _("No known limits, powered by Systran").
116 "<br>".sprintf(_("Number of supported language pairs: %s"),"12")." " ,
38a7b6a0 117 'http://www.dictionary.com/translate' );
118 ShowTrad( 'InterTran',
b0abf4b1 119 _("No known limits, powered by Translation Experts's InterTran").
120 "<br>".sprintf(_("Number of supported languages: %s"),"28")." " ,
38a7b6a0 121 'http://www.tranexp.com/' );
122 ShowTrad( 'GPLTrans',
b0abf4b1 123 _("No known limits, powered by GPLTrans (free, open source)").
124 "<br>".sprintf(_("Number of supported language pairs: %s"),"8")." " ,
38a7b6a0 125 'http://www.translator.cx/' );
eaf943d2 126 ShowTrad( 'OTEnet',
b0abf4b1 127 _("Hellenic translations, no known limits, powered by Systran").
60b628ea 128 "<br>".sprintf(_("Number of supported language pairs: %s"),"20")." " ,
eaf943d2 129 'http://systran.otenet.gr/' );
b0abf4b1 130 ShowTrad( 'PROMT',
131 _("Russian translations, maximum of 500 characters translated").
132 "<br>".sprintf(_("Number of supported language pairs: %s"),"12")." " ,
133 'http://www.translate.ru/' );
38a7b6a0 134?>
849bdf42 135 </ul>
38a7b6a0 136 <p>
137<?php
e38ebf4d 138 echo _("You also decide if you want the translation box displayed, and where it will be located.") .
139 "<form action=\"$PHP_SELF\" method=post>".
140 '<table border=0 cellpadding=0 cellspacing=2>'.
141 '<tr><td align=right nowrap>' .
142 _("Select your translator:") .
143 '</td>'.
144 '<td><select name="translate_translate_server">';
145
849bdf42 146 ShowOption('server', 'babelfish', 'Babelfish');
90dbea5c 147// ShowOption('server', 'go', 'Go.com');
849bdf42 148 ShowOption('server', 'dictionary', 'Dictionary.com');
149 ShowOption('server', 'intertran', 'Intertran');
150 ShowOption('server', 'gpltrans', 'GPLTrans');
eaf943d2 151 ShowOption('server', 'otenet', 'OTEnet');
b0abf4b1 152 ShowOption('server', 'promt', 'PROMT');
38a7b6a0 153 echo '</select>' .
154 '</td></tr>' .
155 '<tr><td align=right nowrap>' .
156 _("When reading:") .
157 '</td>'.
158 '<td><input type=checkbox name="translate_translate_show_read"';
159 if ($translate_show_read)
160 echo " CHECKED";
161 echo '> - ' . _("Show translation box") .
162 ' <select name="translate_translate_location">';
163 ShowOption('location', 'left', _("to the left"));
164 ShowOption('location', 'center', _("in the center"));
165 ShowOption('location', 'right', _("to the right"));
166 echo '</select><br>'.
167 '<input type=checkbox name="translate_translate_same_window"';
168 if ($translate_same_window)
169 echo " CHECKED";
170 echo '> - ' . _("Translate inside the SquirrelMail frames").
171 '</td></tr>'.
172 '<tr><td align=right nowrap>'.
173 _("When composing:") . '</td>'.
174 '<td><input type=checkbox name="translate_translate_show_send"';
849bdf42 175 if ($translate_show_send)
176 echo " CHECKED";
38a7b6a0 177 echo '> - ' . _("Not yet functional, currently does nothing") .
178 '</td></tr>'.
179 '<tr><td></td><td>'.
180 '<input type="submit" value="' . _("Submit") . '" name="submit_translate">'.
181 '</td></tr>'.
182 '</table>'.
183 '</form>'.
184"</body></html>\n";
e38ebf4d 185
15e6162e 186?>