--- /dev/null
+<?php
+/**
+ * SquirrelMail translate plugin sample configuration
+ *
+ * WARNING: This is only an example config. Don't use it for your
+ * configuration. Almisbar translation engine is not public.
+ *
+ * Copyright (c) 2004 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * @version $Id$
+ * @package plugins
+ * @subpackage translate
+ */
+
+global $translate_default_engine;
+$translate_default_engine='babelfish';
+
+global $translate_babelfish_enabled;
+$translate_babelfish_enabled=true;
+
+global $translate_go_enabled;
+$translate_go_enabled=false;
+
+// Provides same options as babelfish. disabled
+global $translate_dictionary_enabled;
+$translate_dictionary_enabled=false;
+
+global $translate_google_enabled;
+$translate_google_enabled=true;
+
+global $translate_intertran_enabled;
+$translate_intertran_enabled=true;
+
+global $translate_promt_enabled;
+$translate_promt_enabled=true;
+
+// interface looks Greek to me :)
+global $translate_otenet_enabled;
+$translate_otenet_enabled=false;
+
+global $translate_gpltrans_enabled;
+$translate_gpltrans_enabled=true;
+
+// we managed to start gpltrans server
+global $translate_gpltrans_url;
+$translate_gpltrans_url='http://www.example.com/cgi-bin/gplTrans';
+
+global $disable_compose_translate;
+$disable_compose_translate=true;
+
+/** Custom translation engine setup */
+
+/**
+ * Controls inclusion of custom translation engines.
+ *
+ * If you enable custon translation engines, you must include
+ * translate_custom(), translate_custom_showtrad() and
+ * $translate_custom_showoption() functions in your config.
+ * @example config-sample.php
+ * @global bool $translate_custom_enabled
+ */
+global $translate_custom_enabled;
+$translate_custom_enabled=true;
+
+/**
+ * Add almisbar translation engine
+ */
+function translate_form_custom($message) {
+ translate_new_form('http://www.almisbar.com/scripts/ata/txttrs.dll');
+ echo '<p align="center">';
+ echo '<input name="lang" type="hidden" value="eng" />';
+ echo '<input name="auth" type="hidden" value="no" />';
+ echo "<inpu name=\"text\" type=\"hidden\" value=\"$message\" />";
+ echo 'Al Misbar: <input type="submit" class=button value="' . _("Translate") . '" />';
+
+ echo '<br />';
+ echo _("Translation Theme:") . ' ';
+ echo '<select size="1" name="atatheme">'.
+ '<option value="0">' . "General" .
+ '<option value="M">' . "Entertainment & Music" .
+ '<option value="H">' . "Sport" .
+ '<option value="1">' . "Business" .
+ '<option value="2">' . "Medical Science" .
+ '<option value="3">' . "Engineering" .
+ '<option value="4">' . "Technology" .
+ '<option value="5">' . "Religion" .
+ '<option value="6">' . "Law & Order" .
+ '<option value="7">' . "Media & Journalism" .
+ '<option value="8">' . "Humanities" .
+ '<option value="9">' . "Agriculture" .
+ '<option value="A">' . "Military" .
+ '<option value="B">' . "Intelligence & Police" .
+ '<option value="C">' . "Politics & Diplomacy" .
+ '<option value="D">' . "Education" .
+ '<option value="E">' . "Industry" .
+ '<option value="F">' . "Oil & Minerals" .
+ '<option value="G">' . "Arts & Literature" .
+ '<option value="I">' . "Space & Astronomy" .
+ '<option value="J">' . "Food & Drink" .
+ '<option value="K">' . "Weather" .
+ '<option value="L">' . "Government" .
+ '<option value="N">' . "Science" .
+ '</select>';
+ echo '<br />';
+ echo '<input checked id="option1" name="options" type="checkbox" value="translit" />';
+ echo "Transliteration of abbreviations";
+ echo '<input checked id="option2" name="options" type="checkbox" value="abbr" />';
+ echo "Transliteration of proper nouns";
+ echo '<input name="vowels" type="checkbox" value="a" />';
+ echo "Show Harakat";
+ echo '</p>';
+
+ translate_table_end();
+}
+
+/**
+ * Add info about almisbar
+ *
+ * String is not translated, because config file might be different
+ */
+function translate_custom_showtrad() {
+ translate_showtrad_internal( 'Al Misbar',
+ "English to Arabic translation (powered by Al-Mutarjim (TM) Al-Arabey and Al-Wafi v2 machine translation engine)",
+ 'http://www.almisbar.com/' );
+}
+
+/**
+ * Add almisbar option
+ */
+function translate_custom_showoption() {
+ translate_showoption_internal('server', 'custom', 'Al Misbar');
+}
+?>
\ No newline at end of file
* @subpackage translate
*/
+/**
+ * Define for wrecked souls accessing functions script directly
+ * @ignore
+ */
+if (!defined('SM_PATH')) {
+ define('SM_PATH','../../');
+}
+
/** Load default config */
if (file_exists(SM_PATH . 'plugins/translate/config_default.php')) {
include_once(SM_PATH . 'plugins/translate/config_default.php');
$translate_gpltrans_enabled=true;
global $translate_custom_enabled;
$translate_custom_enabled=false;
+ // This is logged error message. Don't translate it.
+ error_log('SquirrelMail: default configuration file removed in translate plugin.');
}
/** Load site config */
$translate_dictionary_enabled, $translate_google_enabled,
$translate_gpltrans_enabled, $translate_intertran_enabled,
$translate_promt_enabled, $translate_otenet_enabled;
+ global $translate_custom_enabled;
if (!$translate_show_read) {
return;
$translate_server = getPref($data_dir, $username, 'translate_server',$translate_default_engine);
- $translate_location = getPref($data_dir, $username, 'translate_location');
- if ($translate_location == '') {
- $translate_location = 'center';
- }
+ $translate_location = getPref($data_dir, $username, 'translate_location','center');
$translate_show_send = getPref($data_dir, $username, 'translate_show_send');
$translate_show_read = getPref($data_dir, $username, 'translate_show_read');
}
}
+/**
+ * Save translation options
+ */
+function translate_save_function() {
+ global $username, $data_dir;
+ // Save preferences
+ if (sqgetGlobalVar('submit_translate',$tmp,SQ_POST)) {
+ if (sqgetGlobalVar('translate_translate_server',$translate_server,SQ_POST)) {
+ setPref($data_dir, $username, 'translate_server', $translate_server);
+ } else {
+ setPref($data_dir, $username, 'translate_server', $translate_default_engine);
+ }
+
+ if (sqgetGlobalVar('translate_translate_location',$translate_location,SQ_POST)) {
+ setPref($data_dir, $username, 'translate_location', $translate_location);
+ } else {
+ setPref($data_dir, $username, 'translate_location', 'center');
+ }
+
+ if (sqgetGlobalVar('translate_translate_show_read',$translate_show_read,SQ_POST)) {
+ setPref($data_dir, $username, 'translate_show_read', '1');
+ } else {
+ setPref($data_dir, $username, 'translate_show_read', '');
+ }
+
+ if (sqgetGlobalVar('translate_translate_show_send',$translate_show_send,SQ_POST)) {
+ setPref($data_dir, $username, 'translate_show_send', '1');
+ } else {
+ setPref($data_dir, $username, 'translate_show_send', '');
+ }
+
+ if (sqgetGlobalVar('translate_translate_same_window',$translate_same_windows,SQ_POST)) {
+ setPref($data_dir, $username, 'translate_same_window', '1');
+ } else {
+ setPref($data_dir, $username, 'translate_same_window', '');
+ }
+ }
+}
+
+/**
+ * Set option page name
+ * @access private
+ */
+function translate_set_loadinfo_function() {
+ global $optpage, $optpage_name;
+ if ($optpage=='translate') {
+ $optpage_name=_("Translation Preferences");
+ }
+}
+
/** Option functions */
/**
- *
+ * Creates server selection options
+ * @access private
*/
function translate_showoption() {
global $translate_babelfish_enabled, $translate_go_enabled,
}
/**
- *
+ * Displays comments about available translation engines
+ * @access private
*/
function translate_showtrad() {
global $translate_babelfish_enabled, $translate_go_enabled,
global $translate_gpltrans_url, $translate_custom_enabled;
if ($translate_babelfish_enabled) translate_showtrad_internal( 'Babelfish',
- _("Maximum of 1000 characters translated, powered by Systran").
- '<br />'.sprintf(_("Number of supported language pairs: %s"),'19').' ' ,
+ _("Maximum of 150 words translated, powered by Systran").
+ '<br />'.sprintf(_("Number of supported language pairs: %s"),'36').' ' ,
'http://babelfish.altavista.com/' );
if ($translate_go_enabled) translate_showtrad_internal( 'Translator.Go.com',
_("Maximum of 25 kilobytes translated, powered by Systran").
'http://systran.otenet.gr/' );
if ($translate_promt_enabled) translate_showtrad_internal( 'PROMT',
_("Russian translations, maximum of 500 characters translated").
- '<br />'.sprintf(_("Number of supported language pairs: %s"),'13').' ' ,
+ '<br />'.sprintf(_("Number of supported language pairs: %s"),'16').' ' ,
'http://www.online-translator.com/' );
if ($translate_custom_enabled && function_exists('translate_custom_showtrad')) {
<input type="hidden" name="tt" value="urltext" />
<input type="hidden" name="trtext" value="<?php echo $message; ?>" />
<select name="lp"><?php
- echo translate_lang_opt('en_US', 'zh_CN', 'en_zh',
- sprintf( _("%s to %s"),_("English"),_("Chinese Simplified"))) .
+ echo translate_lang_opt('zh_CN', '', 'zh_en',
+ sprintf( _("%s to %s"),_("Chinese Simplified"),_("English"))) .
+ translate_lang_opt('zh_TW', '', 'zt_en',
+ sprintf( _("%s to %s"),_("Chinese Traditional"),_("English"))) .
+ translate_lang_opt('en_US', 'zh_CN', 'en_zh',
+ sprintf( _("%s to %s"),_("English"),_("Chinese Simplified"))) .
translate_lang_opt('en_US', 'zh_TW', 'en_zt',
sprintf( _("%s to %s"),_("English"),_("Chinese Traditional"))) .
+ translate_lang_opt('en_US', 'nl_NL', 'en_nl',
+ sprintf( _("%s to %s"),_("English"),_("Dutch"))) .
translate_lang_opt('en_US', 'fr_FR', 'en_fr',
sprintf( _("%s to %s"),_("English"),_("French"))) .
translate_lang_opt('en_US', 'de_DE', 'en_de',
sprintf( _("%s to %s"),_("English"),_("German"))) .
+ translate_lang_opt('en_US', 'el_GR', 'en_el',
+ sprintf( _("%s to %s"),_("English"),_("Greek"))) .
translate_lang_opt('en_US', 'it_IT', 'en_it',
sprintf( _("%s to %s"),_("English"),_("Italian"))) .
translate_lang_opt('en_US', 'ja_JP', 'en_ja',
sprintf( _("%s to %s"),_("English"),_("Korean"))) .
translate_lang_opt('en_US', 'pt*', 'en_pt',
sprintf( _("%s to %s"),_("English"),_("Portuguese"))) .
+ translate_lang_opt('en_US', 'ru_RU', 'en_ru',
+ sprintf( _("%s to %s"),_("English"),_("Russian"))) .
translate_lang_opt('en_US', 'es_ES', 'en_es',
sprintf( _("%s to %s"),_("English"),_("Spanish"))) .
- translate_lang_opt('zh_CN', '', 'zh_en',
- sprintf( _("%s to %s"),_("Chinese Simplified"),_("English"))) .
- translate_lang_opt('zh_TW', '', 'zt_en',
- sprintf( _("%s to %s"),_("Chinese Traditional"),_("English"))) .
+ translate_lang_opt('nl_NL', '', 'nl_en',
+ sprintf( _("%s to %s"),_("Dutch"),_("English"))) .
+ translate_lang_opt('nl_NL', '', 'nl_fr',
+ sprintf( _("%s to %s"),_("Dutch"),_("French"))) .
translate_lang_opt('fr_FR', '', 'fr_en',
sprintf( _("%s to %s"),_("French"),_("English"))) .
+ translate_lang_opt('fr_FR', '', 'fr_de',
+ sprintf( _("%s to %s"),_("French"),_("German"))) .
+ translate_lang_opt('fr_FR', '', 'fr_el',
+ sprintf( _("%s to %s"),_("French"),_("Greek"))) .
+ translate_lang_opt('fr_FR', '', 'fr_it',
+ sprintf( _("%s to %s"),_("French"),_("Italian"))) .
+ translate_lang_opt('fr_FR', '', 'fr_pt',
+ sprintf( _("%s to %s"),_("French"),_("Portuguese"))) .
+ translate_lang_opt('fr_FR', '', 'fr_nl',
+ sprintf( _("%s to %s"),_("French"),_("Dutch"))) .
+ translate_lang_opt('fr_FR', '', 'fr_es',
+ sprintf( _("%s to %s"),_("French"),_("Spanish"))) .
translate_lang_opt('de_DE', 'en_US', 'de_en',
sprintf( _("%s to %s"),_("German"),_("English"))) .
+ translate_lang_opt('de_DE', '', 'de_fr',
+ sprintf( _("%s to %s"),_("German"),_("French"))) .
+ translate_lang_opt('el_GR', '', 'el_en',
+ sprintf( _("%s to %s"),_("Greek"),_("English"))) .
+ translate_lang_opt('el_GR', '', 'el_fr',
+ sprintf( _("%s to %s"),_("Greek"),_("French"))) .
translate_lang_opt('it_IT', '', 'it_en',
sprintf( _("%s to %s"),_("Italian"),_("English"))) .
- translate_lang_opt('ja_JP', '', 'ja_en',
+ translate_lang_opt('it_IT', '', 'it_fr',
+ sprintf( _("%s to %s"),_("Italian"),_("French"))) .
+ translate_lang_opt('ja_JP', '', 'ja_en',
sprintf( _("%s to %s"),_("Japanese"),_("English"))) .
- translate_lang_opt('ko_KR', '', 'ko_en',
+ translate_lang_opt('ko_KR', '', 'ko_en',
sprintf( _("%s to %s"),_("Korean"),_("English"))) .
- translate_lang_opt('pt*', '', 'pt_en',
+ translate_lang_opt('pt*', '', 'pt_en',
sprintf( _("%s to %s"),_("Portuguese"),_("English"))) .
- translate_lang_opt('es_ES', '', 'es_en',
+ translate_lang_opt('pt*', '', 'pt_fr',
+ sprintf( _("%s to %s"),_("Portuguese"),_("French"))) .
+ translate_lang_opt('ru_RU', '', 'ru_en',
+ sprintf( _("%s to %s"),_("Russian"),_("English"))) .
+ translate_lang_opt('es_ES', '', 'es_en',
sprintf( _("%s to %s"),_("Spanish"),_("English"))) .
- translate_lang_opt('de_DE', '', 'de_fr',
- sprintf( _("%s to %s"),_("German"),_("French"))) .
- translate_lang_opt('fr_FR', '', 'fr_de',
- sprintf( _("%s to %s"),_("French"),_("German"))) .
- translate_lang_opt('ru_RU', '', 'ru_en',
- sprintf( _("%s to %s"),_("Russian"),_("English")));
+ translate_lang_opt('es_ES', '', 'es_fr',
+ sprintf( _("%s to %s"),_("Spanish"),_("French")));
echo '</select>'.
'Babelfish: <input type="submit" value="' . _("Translate") . '" />';
translate_new_form('http://www.tranexp.com:2000/InterTran');
echo '<input type="hidden" name="topframe" value="yes" />'.
'<input type="hidden" name="type" value="text" />'.
+ '<input type="hidden" name="keyb" value="non" />'.
'<input type="hidden" name="text" value="'.$message.'" />';
$left = '<select name="from">' .
list($usec, $sec) = explode(' ',microtime());
$time = $sec . (float)$usec*100000000;
echo '<input type="hidden" name="text" value="'.$message.'" />'.
- '<input type="hidden" name="r" value="'.$time.'" />'.
+ '<input type="hidden" name="ts" value="'.$time.'" />'.
'<select name="lp">'.
translate_lang_opt('en_US', 'zh_CN', 'en_zh',
sprintf( _("%s to %s"),_("English"),_("Simplified Chinese"))) .
translate_lang_opt('en_US', '', 'es',
sprintf( _("%s to %s"),_("English"),_("Spanish"))) .
translate_lang_opt('es_ES', '', 'se',
- sprintf( _("%s to %s"),_("Spanish"),_("English"))) ;
+ sprintf( _("%s to %s"),_("Spanish"),_("English"))) .
+ translate_lang_opt('en_US', '', 'ef',
+ sprintf( _("%s to %s"),_("English"),_("French"))) .
+ translate_lang_opt('fr_FR', '', 'fe',
+ sprintf( _("%s to %s"),_("French"),_("English"))) .
+ translate_lang_opt('en_US', '', 'ep',
+ sprintf( _("%s to %s"),_("English"),_("Portuguese")));
echo "</select><br />\n";
echo "<input type=\"hidden\" name=\"template\" value=\"General\" />\n";
+ echo _("Transliterate unknown words:") . '<input type="checkbox" id="transliterate" name="transliterate" /><br />';
echo 'PROMT: <input type="submit" value="' . _("Translate") . '" />';
translate_table_end();
*/
function translate_form_google($message) {
translate_new_form('http://www.google.com/translate_t');
-?>
- <input type="hidden" name="ie" value="Unknown" />
- <input type="hidden" name="oe" value="ASCII" />
- <input type="hidden" name="hl" value="en" />
- <input type="hidden" name="text" value="<?php echo $message; ?>" />
- <select name="langpair"><?php
- echo translate_lang_opt('en_US', 'de_DE', 'en|de',
- sprintf( _("%s to %s"),_("English"),_("German"))) .
+ echo '<input type="hidden" name="ie" value="Unknown" />' .
+ '<input type="hidden" name="oe" value="ASCII" />' .
+ '<input type="hidden" name="hl" value="en" />' .
+ '<input type="hidden" name="text" value="' . $message . '" />';
+ echo '<select name="langpair">'.
+ translate_lang_opt('en_US', 'de_DE', 'en|de',
+ sprintf( _("%s to %s"),_("English"),_("German"))) .
translate_lang_opt('en_US', 'es_ES', 'en|es',
sprintf( _("%s to %s"),_("English"),_("Spanish"))) .
translate_lang_opt('en_US', 'fr_FR', 'en|fr',
*/
define('SM_PATH','../../');
-/* SquirrelMail required files. */
+/** SquirrelMail required files. */
include_once(SM_PATH . 'include/validate.php');
-include_once(SM_PATH . 'functions/display_messages.php');
-include_once(SM_PATH . 'functions/imap.php');
+/** Plugin functions */
include_once(SM_PATH . 'plugins/translate/functions.php');
displayPageHeader($color, 'None');
-// Save preferences
-if (sqgetGlobalVar('submit_translate',$tmp,SQ_POST)) {
- if (sqgetGlobalVar('translate_translate_server',$translate_translate_server,SQ_POST)) {
- setPref($data_dir, $username, 'translate_server', $translate_translate_server);
- } else {
- setPref($data_dir, $username, 'translate_server', $translate_default_engine);
- }
-
- if (sqgetGlobalVar('translate_translate_location',$translate_translate_location,SQ_POST)) {
- setPref($data_dir, $username, 'translate_location', $translate_translate_location);
- } else {
- setPref($data_dir, $username, 'translate_location', 'center');
- }
-
- if (sqgetGlobalVar('translate_translate_show_read',$tmp,SQ_POST)) {
- setPref($data_dir, $username, 'translate_show_read', '1');
- } else {
- setPref($data_dir, $username, 'translate_show_read', '');
- }
-
- if (sqgetGlobalVar('translate_translate_show_send',$tmp,SQ_POST)) {
- setPref($data_dir, $username, 'translate_show_send', '1');
- } else {
- setPref($data_dir, $username, 'translate_show_send', '');
- }
-
- if (sqgetGlobalVar('translate_translate_same_window',$tmp,SQ_POST)) {
- setPref($data_dir, $username, 'translate_same_window', '1');
- } else {
- setPref($data_dir, $username, 'translate_same_window', '');
- }
-}
-
-// Move these calls to separate function
-$translate_server = getPref($data_dir, $username, 'translate_server',$translate_default_engine);
-
-$translate_location = getPref($data_dir, $username, 'translate_location');
-if ($translate_location == '') {
- $translate_location = 'center';
-}
-$translate_show_read = getPref($data_dir, $username, 'translate_show_read');
-$translate_show_send = getPref($data_dir, $username, 'translate_show_send');
-$translate_same_window = getPref($data_dir, $username, 'translate_same_window');
-
?>
<table width="95%" align="center" border="0" cellpadding="1" cellspacing="0"><tr><td bgcolor="<?php echo $color[0]; ?>">
<center><b><?php echo _("Options") . ' - '. _("Translator"); ?></b></center>
</td></tr></table>
- <?php if (sqgetGlobalVar('submit_translate',$tmp,SQ_POST)) {
- print '<center><h4>'._("Saved Translation Options")."</h4></center>\n";
- }?>
-
<p><?php echo _("Your server options are as follows:"); ?></p>
<ul>
<p>
<?php
echo _("You also decide if you want the translation box displayed, and where it will be located.") .
- '<form action="'.$PHP_SELF.'" method="post">'.
+ '<form action="'.sqm_baseuri().'src/options.php'.'" method="post">'.
+ '<input type="hidden" name="optmode" value="submit">' .
+ '<input type="hidden" name="optpage" value="translate">' .
'<table border="0" cellpadding="0" cellspacing="2">'.
'<tr><td align="right" nowrap="nowrap">' .
_("Select your translator:") .