Re: [SM-USERS] Translation ar

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



See attached patch. When form is used, browser must use character set
defined in <form> accept-header attribute. Works in Firefox and Opera. Not
sure about IE. if browser does not use defined character set, interface
must be running in utf-8.

> Dear Tomas,
>
> Thank you on getting English to Arabic, now how can I edit so that I can
> have Arabic to English.
>
> The file I was editing was setup.php
>
> Please advice, Thank you
>
> Regards
>
>
> On 6/8/06, Tomas Kuliavas <tokul@xxxxxxxxxxxxxxxxxxxxx> wrote:
>>
>> > Dear all,
>> >
>> > I am trying to put in the BETA translation that Google offers; the one
>> > that I am trying to configure is the English to Arabic BETA
>> >
>> > I had edit the translation plugin (index.php) by adding
>> >
>> > translate_lang_opt('en_US', 'ar*', 'en|ar', sprintf( _("%s to
>> > %s"),_("English"),_("Arabic BETA"))) .
>> >
>> > in to google section. But it fails as it display ? ????? ??? ????????
>> in
>> > the translate result box.
>> >
>> > My operating system is using english
>> >
>> > What else I need to change to have this new translation working?
>>
>> find
>> ----
>>    echo '<input type="hidden" name="ie" value="Unknown" />' .
>>         '<input type="hidden" name="oe" value="ASCII" />' .
>> ----
>>
>> in translate_form_google() function and replace input field values with
>> 'UTF8'. In order to translate from English to Arabic, it is enough to
>> set
>> 'oe' field value to 'UTF8'.
>>
>> Translation from Arabic to English might require more modifications.
>>
>> --
>> Tomas
--- setup.php.orig	2006-02-04 00:27:53.000000000 +0200
+++ setup.php	2006-06-09 14:49:04.824761744 +0300
@@ -200,7 +200,7 @@
 }
 
 /** starts translation engine form */
-function translate_new_form($action) {
+function translate_new_form($action,$charset=null) {
     global $translate_dir, $translate_new_window, $translate_location;
     global $color, $translate_same_window;
 
@@ -218,6 +218,10 @@
         echo ' target="_blank"';
     }
 
+    if (!is_null($charset)) {
+        echo ' accept-charset="' . htmlspecialchars($charset) . '"';
+    }
+
     echo ">\n";
 
     ?><table align="<?php echo $translate_location ?>" cellpadding="3" 
@@ -681,9 +685,9 @@
  * @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" />' .
+    translate_new_form('http://www.google.com/translate_t','utf-8');
+    echo '<input type="hidden" name="ie" value="UTF8" />' .
+         '<input type="hidden" name="oe" value="UTF8" />' .
          '<input type="hidden" name="hl" value="en" />' .
          '<input type="hidden" name="text" value="' . $message . '" />';
     echo '<select name="langpair">'.
@@ -710,7 +714,11 @@
          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('en_US', 'ar*', 'en|ar',
+                            sprintf( _("%s to %s"),_("English"),_("Arabic")));
     echo '</select>'.
          'Google: <input type="submit" value="' . _("Translate") . '" />';
 
--
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

[Index of Archives]     [Video For Linux]     [Yosemite News]     [Yosemite Photos]     [gtk]     [KDE]     [Cyrus SASL]     [Gimp on Windows]     [Steve's Art]     [Webcams]

  Powered by Linux