* Copyright (c) 1999-2004 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
- * $Id$
+ * @version $Id$
* @package plugins
* @subpackage translate
*/
/**
* Initialize the translation plugin
* @return void
+ * @access private
*/
function squirrelmail_plugin_init_translate() {
global $squirrelmail_plugin_hooks;
/**
* Shows translation box in message display window
+ * @access private
*/
function translate_read_form() {
global $color, $translate_server;
$new_body = $body;
$pos = strpos($new_body,
- '">'. _("Download this as a file") . '</A></CENTER><BR></SMALL>');
+ '">'. _("Download this as a file") . '</a></center><br /></small>');
if (is_int($pos)) {
$new_body = substr($new_body, 0, $pos);
}
/**
* Closes table tags in translation box
+ * @access private
*/
function translate_table_end() {
?></td>
}
/**
- * FIXME:
- * Undocumented function.
+ * FIXME: Undocumented function.
+ * @access private
*/
function translate_button() {
global $translate_show_send;
/**
* Adds translation option block
+ * @access private
*/
function translate_optpage_register_block() {
global $optpage_blocks;
/**
* Gets user's translation preferences
+ * @access private
*/
function translate_pref() {
global $username, $data_dir;
/**
* Tries to select default translation combination
- *
- * @param string $test language code that has to be tested.
- * @returm boolean true if language code matches user's language.
*
* This function could be speed up.
* It basically negates the process if a ! is found in the beginning and
* matches a * at the end with 0 or more characters.
+ *
+ * @param string $test language code that has to be tested.
+ * @return boolean true if language code matches user's language.
+ * @access private
*/
function translate_does_it_match_language($test) {
global $squirrelmail_language;
/**
* Creates language option selection box.
+ *
+ * @access private
*/
function translate_lang_opt($from, $to, $value, $text) {
global $translate_dir;
$ret = ' <option value="' . $value . '"';
if (translate_does_it_match_language($to) && ($translate_dir == 'to')) {
- $ret .= ' SELECTED';
+ $ret .= ' selected="selected"';
}
if (translate_does_it_match_language($from) && ($translate_dir == 'from')) {
- $ret .= ' SELECTED';
+ $ret .= ' selected="selected"';
}
$ret .= '>' . $text . "</option>\n";
* Starts translation box
*
* @param string $action url that has to recieve message for translation
+ * @access private
*/
function translate_new_form($action) {
global $translate_dir, $translate_new_window, $translate_location;
* Babelfish translation engine functions
*
* @param string $message text that has to be translated.
+ * @access private
*/
function translate_form_babelfish($message) {
translate_new_form('http://babelfish.altavista.com/babelfish/tr');
?>
- <input type="hidden" name="doit" value="done">
- <input type="hidden" name="intl" value="1">
- <input type="hidden" name="tt" value="urltext">
- <input type="hidden" name="urltext" value="<?php echo $message; ?>">
+ <input type="hidden" name="doit" value="done" />
+ <input type="hidden" name="intl" value="1" />
+ <input type="hidden" name="tt" value="urltext" />
+ <input type="hidden" name="urltext" value="<?php echo $message; ?>" />
<select name="lp"><?php
echo translate_lang_opt('en_US', 'zh_CN', 'en_zh',
sprintf( _("%s to %s"),_("English"),_("Chinese"))) .
translate_lang_opt('ru_RU', '', 'ru_en',
sprintf( _("%s to %s"),_("Russian"),_("English")));
echo '</select>'.
- 'Babelfish: <input type="Submit" value="' . _("Translate") . '">';
+ 'Babelfish: <input type="submit" value="' . _("Translate") . '" />';
translate_table_end();
}
* go.com translation engine (disabled)
*
* @param string $message text that has to be translated
+ * @access private
*/
function translate_form_go($message) {
translate_new_form('http://translator.go.com/cb/trans_entry');
?>
- <input type=hidden name=input_type value=text>
- <select name=lp><?php
+ <input type="hidden" name="input_type" value="text" />
+ <select name="lp"><?php
echo translate_lang_opt('en_US', 'es_ES', 'en_sp',
sprintf( _("%s to %s"),_("English"),_("Spanish"))) .
translate_lang_opt('en_US', 'fr_FR', 'en_fr',
translate_lang_opt('pt*', '', 'pt_en',
sprintf( _("%s to %s"),_("Portuguese"),_("English")));
echo '</select>'.
- "<input type=\"hidden\" name=\"text\" value=\"$message\">".
- 'Go.com: <input type="Submit" value="' . _("Translate") . '">';
+ '<input type="hidden" name="text" value="'.$message.'" />'.
+ 'Go.com: <input type="submit" value="' . _("Translate") . '" />';
translate_table_end();
}
* intertran translation engine
*
* @param string $message text that has to be translated
+ * @access private
*/
function translate_form_intertran($message) {
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=\"text\" value=\"$message\">";
+ echo '<input type="hidden" name="topframe" value="yes" />'.
+ '<input type="hidden" name="type" value="text" />'.
+ '<input type="hidden" name="text" value="'.$message.'" />';
- $left = '<SELECT name="from">' .
+ $left = '<select name="from">' .
translate_lang_opt('pt_BR', '', 'pob', _("Brazilian Portuguese")).
translate_lang_opt('bg_BG', '', 'bul', _("Bulgarian") . ' (CP 1251)').
translate_lang_opt('hr_HR', '', 'cro', _("Croatian") . ' (CP 1250)').
translate_lang_opt('sv_SE', '', 'swe', _("Swedish")).
translate_lang_opt('tr_TR', '', 'tur', _("Turkish") . ' (CP 1254)').
translate_lang_opt('cy_GB', '', 'wel', _("Welsh")).
- '</SELECT>';
+ '</select>';
- $right = '<SELECT name="to">'.
+ $right = '<select name="to">'.
translate_lang_opt('', 'pt_BR', 'pob', _("Brazilian Portuguese")).
translate_lang_opt('', 'bg_BG', 'bul', _("Bulgarian") . ' (CP 1251)').
translate_lang_opt('', 'hr_HR', 'cro', _("Croatian") . ' (CP 1250)').
translate_lang_opt('', 'sv_SE', 'swe', _("Swedish")).
translate_lang_opt('', 'tr_TR', 'tur', _("Turkish") . ' (CP 1254)').
translate_lang_opt('', 'cy_GB', 'wel', _("Welsh")).
- '</SELECT>';
+ '</select>';
printf( _("%s to %s"), $left, $right );
- echo 'InterTran: <input type=submit value="' . _("Translate") . '">';
+ echo 'InterTran: <input type="submit" value="' . _("Translate") . '" />';
translate_table_end();
}
* gpltrans translation engine
*
* @param string $message text that has to be translated
+ * @access private
*/
function translate_form_gpltrans($message) {
translate_new_form('http://www.translator.cx/cgi-bin/gplTrans');
translate_lang_opt('', 'es_ES', 'spanish_dict', _("Spanish")).
'</select>';
echo '<select name="toenglish">';
- echo '<option value="yes" >'. _("to English") . '</option>';
- echo '<option value="no" selected>' . _("from English") . '</option></select>';
- echo "<input type=hidden name=text value=\"$message\">".
- 'GPLTrans: <input type="submit" value="' . _("Translate") . '">';
+ echo '<option value="yes">'. _("to English") . '</option>';
+ echo '<option value="no" selected="selected">' . _("from English") . '</option></select>';
+ echo '<input type="hidden" name="text" value="'.$message.'" />'.
+ 'GPLTrans: <input type="submit" value="' . _("Translate") . '" />';
translate_table_end();
}
* reference.com (dictionary) translation engine
*
* @param string $message text that has to be translated
+ * @access private
*/
function translate_form_dictionary($message) {
translate_new_form('http://dictionary.reference.com/translate/text.html');
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\" />".
- '<SELECT NAME="lp">'.
+ echo '<input type="hidden" name="text" value="'.$message.'" />'.
+ '<input type="hidden" name="r" 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', 'zh_TW', 'en_zt',
sprintf( _("%s to %s"),_("Russian"),_("English"))) .
translate_lang_opt('es_ES', '', 'es_en',
sprintf( _("%s to %s"),_("Spanish"),_("English"))) .
- '</SELECT>'.
- 'Dictionary.com: <INPUT TYPE="submit" VALUE="'._("Translate").'">';
+ '</select>'.
+ 'Dictionary.com: <input type="submit" value="'._("Translate").'" />';
translate_table_end();
}
* otenet translation engine
*
* @param string $message text that has to be translated
+ * @access private
*/
function translate_form_otenet($message) {
translate_new_form('http://systran.otenet.gr/cgi-bin/systran.cgi');
?>
- <input type="hidden" name="doit" value="done">
- <INPUT NAME="partner" VALUE="OTEnet-en" type="hidden">
- <input type="hidden" name="urltext" value="<?php echo $message; ?>">
+ <input type="hidden" name="doit" value="done" />
+ <input type="hidden" name="partner" value="OTEnet-en" />
+ <input type="hidden" name="urltext" value="<?php echo $message; ?>" />
<select name="lp" size="1"><?php
echo translate_lang_opt('en_US', 'el_GR', 'en_el',
sprintf( _("%s to %s"),_("English"),_("Greek"))) .
sprintf( _("%s to %s"),_("French"),_("Greek"))) .
translate_lang_opt('el_GR', 'fr_FR', 'el_fr',
sprintf( _("%s to %s"),_("Greek"),_("French"))) .
- translate_lang_opt('#', '', '', "----------------") .
+ translate_lang_opt('#', '', '', '----------------') .
translate_lang_opt('en_US', '', 'en_fr',
sprintf( _("%s to %s"),_("English"),_("French"))) .
translate_lang_opt('fr_FR', '', 'fr_en',
translate_lang_opt('nl_NL', '', 'nl_fr',
sprintf( _("%s to %s"),_("Dutch"),_("French"))) ;
echo '</select>'.
- 'OTEnet: <input type="Submit" value="' . _("Translate") . '">';
+ 'OTEnet: <input type="submit" value="' . _("Translate") . '" />';
translate_table_end();
}
* promt translation engine
*
* @param string $message text that has to be translated
+ * @access private
*/
function translate_form_promt($message) {
- translate_new_form('http://www.translate.ru/text.asp#tr_form');
- echo '<input type="hidden" name="status" value="translate">';
- echo "<input type=\"hidden\" name=\"source\" value=\"$message\">";
+ translate_new_form('http://www.online-translator.com/text.asp#tr_form');
+ echo '<input type="hidden" name="status" value="translate" />';
+ echo '<input type="hidden" name="source" value="'.$message.'" />';
echo _("Interface language")." : ";
echo "<select size=\"1\" name=\"lang\">\n";
- echo "<option value=\"en\">" . _("English") . "</option>\n";
- echo "<option value=\"ru\">" . _("Russian") . "</option>\n";
- echo "<option value=\"de\">" . _("German") . "</option>\n";
- echo "<option value=\"fr\">" . _("French") . "</option>\n";
- echo "<option value=\"es\">" . _("Spanish") . "</option>\n";
- echo "</select><br>\n";
+ echo '<option value="en">' . _("English") . "</option>\n";
+ echo '<option value="ru">' . _("Russian") . "</option>\n";
+ echo '<option value="de">' . _("German") . "</option>\n";
+ echo '<option value="fr">' . _("French") . "</option>\n";
+ echo '<option value="es">' . _("Spanish") . "</option>\n";
+ echo "</select><br />\n";
echo _("Translation direction")." : ";
echo '<select size="1" id="direction" name="direction">';
echo translate_lang_opt('en_US', 'ru_RU', 'er',
sprintf( _("%s to %s"),_("English"),_("Spanish"))) .
translate_lang_opt('es_ES', '', 'se',
sprintf( _("%s to %s"),_("Spanish"),_("English"))) ;
- echo "</select><br>\n";
- echo "<input type=\"hidden\" name=\"template\" value=\"General\">\n";
- echo 'PROMT: <input type="submit" value="' . _("Translate") . '">';
+ echo "</select><br />\n";
+ echo "<input type=\"hidden\" name=\"template\" value=\"General\" />\n";
+ echo 'PROMT: <input type="submit" value="' . _("Translate") . '" />';
translate_table_end();
}
* google translation engine
*
* @param string $message text that has to be translated
+ * @access private
*/
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; ?>">
+ <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"))) .
translate_lang_opt('pt*', '', 'pt|en',
sprintf( _("%s to %s"),_("Portuguese"),_("English")));
echo '</select>'.
- 'Google: <input type="Submit" value="' . _("Translate") . '">';
+ 'Google: <input type="submit" value="' . _("Translate") . '" />';
translate_table_end();
}
-?>
+?>
\ No newline at end of file