Added Turkish option. But plugin still needs to be fixed and made E_ALL
[squirrelmail.git] / plugins / translate / setup.php
index 99bf7760c4a6b22eb5e6d3fe0b27265a46b8309e..281f53b71acc3dd04d8620f23b3eaf21cb6a15ec 100644 (file)
@@ -1,5 +1,14 @@
 <?php
 
+/**
+ * setup.php
+ *
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * $Id$
+ */
+
 /* Easy plugin that sends the body of the message to a new browser
 window using the specified translator.  It can also translate your
 outgoing message if you send it to someone in a different country. 
@@ -27,8 +36,7 @@ function squirrelmail_plugin_init_translate() {
   global $squirrelmail_plugin_hooks;
 
   $squirrelmail_plugin_hooks['read_body_bottom']['translate'] = 'translate_read_form';
-  $squirrelmail_plugin_hooks['options_register']['translate'] = 'translate_opt';
-  $squirrelmail_plugin_hooks['options_save']['translate'] = 'translate_sav';
+  $squirrelmail_plugin_hooks['optpage_register_block']['translate'] = 'translate_optpage_register_block';
   $squirrelmail_plugin_hooks['loading_prefs']['translate'] = 'translate_pref';
   $squirrelmail_plugin_hooks['compose_button_row']['translate'] = 'translate_button';
 }
@@ -48,12 +56,12 @@ function translate_read_form() {
             
     $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);
     }
-                     
-    $trans = get_html_translation_table('HTMLENTITIES');
+
+    $trans = get_html_translation_table(HTML_ENTITIES);
     $trans[' '] = '&nbsp;';
     $trans = array_flip($trans);
     $new_body = strtr($new_body, $trans);
@@ -90,9 +98,9 @@ function translate_button() {
 }
 
 
-function translate_opt() {
-    global $optionpages;
-    $optionpages[] = array(
+function translate_optpage_register_block() {
+    global $optpage_blocks;
+    $optpage_blocks[] = array(
         'name' => _("Translation Options"),
         'url'  => '../plugins/translate/options.php',
         'desc' => _("Which translator should be used when you get messages in a different language?"),
@@ -100,50 +108,6 @@ function translate_opt() {
     );
 }
 
-function translate_sav() {
-    global $username,$data_dir;
-    global $submit_translate, $translate_translate_server;
-    global $translate_translate_location;
-    global $translate_translate_show_read;
-    global $translate_translate_show_send;
-    global $translate_translate_same_window;
-  
-    if ($submit_translate) {
-        if (isset($translate_translate_server)) {
-            setPref($data_dir, $username, 'translate_server', $translate_translate_server);
-        } else {
-            setPref($data_dir, $username, 'translate_server', 'babelfish');
-        }
-
-        if (isset($translate_translate_location)) {
-            setPref($data_dir, $username, 'translate_location', $translate_translate_location);
-        } else {
-            setPref($data_dir, $username, 'translate_location', 'center');
-        }
-
-        if (isset($translate_translate_show_read)) {
-            setPref($data_dir, $username, 'translate_show_read', '1');
-        } else {
-            setPref($data_dir, $username, 'translate_show_read', '');
-        }
-
-        if (isset($translate_translate_show_send)) {
-            setPref($data_dir, $username, 'translate_show_send', '1');
-        } else {
-            setPref($data_dir, $username, 'translate_show_send', '');
-        }
-
-        if (isset($translate_translate_same_window)) {
-           setPref($data_dir, $username, 'translate_same_window', '1');
-        } else {
-            setPref($data_dir, $username, 'translate_same_window', '');
-        }
-
-        echo '<center>Translation options saved.</center>';
-    }
-}
-
-
 function translate_pref() { 
     global $username, $data_dir;
     global $translate_server, $translate_location;
@@ -405,6 +369,7 @@ function translate_form_intertran($message) {
         translate_lang_opt('',      '',    'slo', _("Slovenian") . ' (CP 1250)').
         translate_lang_opt('es',    '',    'spa', _("Spanish")).
         translate_lang_opt('sv',    '',    'swe', _("Swedish")).
+        translate_lang_opt('',      '',    'tur', _("Turkish") . ' (CP 1254)').
         translate_lang_opt('',      '',    'wel', _("Welsh")).
         '</SELECT>';
 
@@ -435,6 +400,7 @@ function translate_form_intertran($message) {
         translate_lang_opt('',    '',      'slo', _("Slovenian") . ' (CP 1250)').
         translate_lang_opt('',    'es',    'spa', _("Spanish")).
         translate_lang_opt('',    'sv',    'swe', _("Swedish")).
+        translate_lang_opt('',      '',    'tur', _("Turkish") . ' (CP 1254)').
         translate_lang_opt('',    '',      'wel', _("Welsh")).
         '</SELECT>';
     printf( _("%s to %s"), $left, $right );
@@ -517,7 +483,7 @@ function translate_form_dictionary($message) {
                             sprintf( _("%s to %s"),
                                      _("Spanish"),
                                      _("English"))) .
-         '<\SELECT>'.
+         '</SELECT>'.
          'Dictionary.com: <INPUT TYPE="submit" VALUE="'._("Translate").'">';
 
   translate_table_end();