> Dear All,
>
> Lately when I upgrade my squirrelmail to 1.4.8-1 under my debian-sid, I
> found that my google translate not working, it shows unable to
> translate, I thought it was due to my patch to support Arabic language,
> but, actually the original one doesn't work as well,
Google checks order of form fields. Issue should be fixed in 1.4.9cvs.
--
Tomas
? changes.diff
Index: options.php
===================================================================
RCS file: /cvsroot/squirrelmail/squirrelmail/plugins/translate/options.php,v
retrieving revision 1.17.2.8
diff -u -r1.17.2.8 options.php
--- options.php 3 Feb 2006 22:27:53 -0000 1.17.2.8
+++ options.php 15 Aug 2006 13:59:17 -0000
@@ -138,7 +138,7 @@
'http://www.online-translator.com/' );
ShowTrad( 'Google Translate',
_("No known limits, powered by Systran").
- '<br />'.sprintf(_("Number of supported language pairs: %s"),'12').' ' ,
+ '<br />'.sprintf(_("Number of supported language pairs: %s"),'20').' ' ,
'http://www.google.com/translate' );
?>
</ul>
Index: setup.php
===================================================================
RCS file: /cvsroot/squirrelmail/squirrelmail/plugins/translate/setup.php,v
retrieving revision 1.11.2.12
diff -u -r1.11.2.12 setup.php
--- setup.php 12 Mar 2006 13:57:40 -0000 1.11.2.12
+++ setup.php 15 Aug 2006 13:59:18 -0000
@@ -199,8 +199,15 @@
return( $ret );
}
-/** starts translation engine form */
-function translate_new_form($action) {
+/**
+ * Starts translation box
+ *
+ * @param string $action url that has to recieve message for translation
+ * @param string $charset (since sm 1.5.1 and 1.4.9) character set, that
+ * should be used to submit 8bit information.
+ * @access private
+ */
+function translate_new_form($action,$charset=null) {
global $translate_dir, $translate_new_window, $translate_location;
global $color, $translate_same_window;
@@ -218,6 +225,9 @@
echo ' target="_blank"';
}
+ if (! is_null($charset))
+ echo ' accept-charset="'.htmlspecialchars($charset).'"';
+
echo ">\n";
?><table align="<?php echo $translate_location ?>" cellpadding="3"
@@ -681,11 +691,8 @@
* @access private
*/
function translate_form_google($message) {
- translate_new_form('http://www.google.com/translate_t');
- 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 . '" />';
+ translate_new_form('http://www.google.com/translate_t','utf-8');
+ echo '<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"))) .
@@ -697,6 +704,14 @@
sprintf( _("%s to %s"),_("English"),_("Italian"))) .
translate_lang_opt('en_US', 'pt*', 'en|pt',
sprintf( _("%s to %s"),_("English"),_("Portuguese"))) .
+ translate_lang_opt('en_US', 'ar', 'en|ar',
+ sprintf( _("%s to %s"),_("English"),_("Arabic"))) .
+ translate_lang_opt('en_US', 'ja_JP', 'en|ja',
+ sprintf( _("%s to %s"),_("English"),_("Japanese"))) .
+ translate_lang_opt('en_US', 'ko_KR', 'en|ko',
+ sprintf( _("%s to %s"),_("English"),_("Korean"))) .
+ translate_lang_opt('en_US', 'zh_CN', 'en|zh-CN',
+ sprintf( _("%s to %s"),_("English"),_("Chinese (Simplified)"))) .
translate_lang_opt('de_DE', 'en_US', 'de|en',
sprintf( _("%s to %s"),_("German"),_("English"))) .
translate_lang_opt('de_DE', '', 'de|fr',
@@ -710,10 +725,20 @@
translate_lang_opt('it_IT', '', 'it|en',
sprintf( _("%s to %s"),_("Italian"),_("English"))) .
translate_lang_opt('pt*', '', 'pt|en',
- sprintf( _("%s to %s"),_("Portuguese"),_("English")));
+ sprintf( _("%s to %s"),_("Portuguese"),_("English"))).
+ translate_lang_opt('ar', '', 'ar|en',
+ sprintf( _("%s to %s"),_("Arabic"),_("English"))).
+ translate_lang_opt('ja_JP', '', 'ja|en',
+ sprintf( _("%s to %s"),_("Japanese"),_("English"))).
+ translate_lang_opt('ko_KR', '', 'ko|en',
+ sprintf( _("%s to %s"),_("Korean"),_("English"))).
+ translate_lang_opt('zh_CN', '', 'zh-CN|en',
+ sprintf( _("%s to %s"),_("Chinese (Simplified)"),_("English")));
echo '</select>'.
- 'Google: <input type="submit" value="' . _("Translate") . '" />';
+ '<input type="hidden" name="hl" value="en" />' .
+ '<input type="hidden" name="ie" value="UTF8" />' .
+ '<input type="hidden" name="oe" value="UTF8" />' .
+ 'Google: <input type="submit" value="' . _("Translate") . '" />';
translate_table_end();
}
-?>
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
--
squirrelmail-users mailing list
Posting Guidelines: http://www.squirrelmail.org/wiki/MailingListPostingGuidelines
List Address: squirrelmail-users@xxxxxxxxxxxxxxxxxxxxx
List Archives: http://news.gmane.org/thread.php?group=gmane.mail.squirrelmail.user
List Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=2995
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-users