--- notify.module	2008-12-17 23:00:06.000000000 +0100
+++ notify.module	2010-03-10 22:01:36.000000000 +0100
@@ -48,34 +48,48 @@ function notify_admin_settings() {
   
   $form['notify_settings']['notify_send'] = array(
     '#type' => 'select',
-    '#title' => 'Send notifications every',
+    '#title' => t('Send notifications every'),
     '#default_value' => variable_get('notify_send', array(86400)),
     '#options' => $period,
-    '#description' => 'How often should new content notifications be sent? Requires cron to be running at least this often.',
+    '#description' => t('How often should new content notifications be sent? Requires cron to be running at least this often.'),
   );
   
   $form['notify_settings']['notify_send_hour'] = array(
     '#type' => 'select',
-    '#title' => 'Hour to Send Notifications',
-    '#description' => 'Specify the hour (24-hour clock) in which notifications should be sent, if the frequency is one day or greater.',
+    '#title' => t('Hour to Send Notifications'),
+    '#description' => t('Specify the hour (24-hour clock) in which notifications should be sent, if the frequency is one day or greater.'),
     '#default_value' => variable_get('notify_send_hour', 9),
     '#options' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23),
   );
   
   $form['notify_settings']['notify_attempts'] = array(
     '#type' => 'select',
-    '#title' => 'Number of failed sends after which notifications are disabled',
+    '#title' => t('Number of failed sends after which notifications are disabled'),
     '#default_value' => variable_get('notify_attempts', array(5)),
     '#options' => array(t('Disabled'), 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20),
   );
     
+  $form['notify_settings']['notify_register_display'] = array(
+	'#type' => 'checkbox',
+	'#title' => t('Display Notification settings on the user registration form.'),
+	'#return_value' => 1,
+	'#default_value' => variable_get('notify_register_display', 1),
+  );
+    
+  $form['notify_settings']['notify_register_default'] = array(
+	'#type' => 'checkbox',
+	'#title' => t('Enable notification by default for new user.'),
+	'#return_value' => 1,
+	'#default_value' => variable_get('notify_register_default', 1),
+  );
+    
   $set = 'ntype';
   $form[$set] = array(
     '#type' => 'fieldset',
-    '#title' => 'Notification by node type',
+    '#title' => t('Notification by node type'),
     '#collapsible' => true,
     '#collapsed' => false,
-    '#description' => 'Having nothing checked defaults to sending notifications about all node types.'
+    '#description' => t('Having nothing checked defaults to sending notifications about all node types.')
   );
   
   foreach (node_get_types('types', array()) as $type => $object) {
@@ -116,10 +130,13 @@ function notify_user($type, &$edit, &$us
       break;
     
     case 'register':
-      return _notify_user_reg_fields();
+      return variable_get('notify_register_display', 1) ? _notify_user_reg_fields() : NULL;
       break;
     
     case 'insert':
+      if(!variable_get('notify_register_display', 1)) {
+        $edit['notify_decision'] = variable_get('notify_register_default', 1);
+      }
       if (isset($edit['notify_decision']) && $edit['notify_decision'] == 1){
         db_query('INSERT INTO {notify} (uid, status, node, teasers, comment) VALUES (%d, %d, %d, %d, %d)', $user->uid, 1, 1, 0, 0);
         $edit['notify_decision'] = NULL;
@@ -147,10 +164,10 @@ function _notify_user_reg_fields() {
   // Add the checkbox to the fieldset
   $fields['notify_agree']['notify_decision'] = array(
     '#type' => 'checkbox',
-    '#title' => t('Receive email notifications of news posted to this site. Notifications are sent every ' . format_interval($period).'.'),
+    '#title' => t('Receive email notifications of news posted to this site. Notifications are sent every !period.', array('!period' => format_interval($period))),
     '#return_value' => 1,
-    '#default_value' => 1,
-    '#description' => t('By accepting to receive <em>daily email news notifications</em>, you will be kept informed of news associated with ' . variable_get('site_name', 'Drupal') . '.')
+    '#default_value' => variable_get('notify_register_default', 1),
+    '#description' => t('By accepting to receive <em>daily email news notifications</em>, you will be kept informed of news associated with !sitename.', array('!sitename' => variable_get('site_name', 'Drupal')))
   );
 
   return $fields;
@@ -238,9 +255,9 @@ function notify_user_settings_form(&$for
         drupal_set_message(t('Your e-mail address must be specified on your <a href="@url">my account</a> page.', array('@url' => url('user/'. $account->uid .'/edit'))), 'error');
   }
 
-  $form['notify_page_master'] = array('#type' => 'fieldset', '#title' => 'Master switch');
+  $form['notify_page_master'] = array('#type' => 'fieldset', '#title' => t('Master switch'));
   $form['notify_page_master']['status'] = array('#type' => 'radios',
-    '#title' => 'Notify status',
+    '#title' => t('Notify status'),
     '#default_value' => $notify->status,
     '#options' =>  array(t('Disabled'), t('Enabled')),
     '#description' => t('Do you wish to receive periodic e-mails when new content is posted?'),
@@ -248,13 +265,13 @@ function notify_user_settings_form(&$for
 
   $form['notify_page_detailed'] = array('#type' => 'fieldset', '#title' => t('Detailed settings'));
   $form['notify_page_detailed']['node'] = array('#type' => 'radios',
-    '#title' => 'Notify new content',
+    '#title' => t('Notify new content'),
     '#default_value' => $notify->node,
     '#options' => array(t('Disabled'), t('Enabled')),
     '#description' => t('Include new content in the notification mail.'),
   );
   $form['notify_page_detailed']['teasers'] = array('#type' => 'radios',
-    '#title' => 'Content',
+    '#title' => t('Content'),
     '#default_value' => $notify->teasers,
     '#options' => array(t('Title only'), t('Title + Teaser'), t('Title + Body')),
     '#description' => t('Select the amount of each post that you would like to see in your notification e-mails.'),
@@ -473,7 +490,7 @@ function _notify_send() {
       // Prepend node e-mail header as long as user could access at least one node.
       if ($node_count > 0) {
         $node_body = $separator ."\n"
-          . t('Recent content - !count', array('!count' => format_plural(count($nodes), '1 new post', count($nodes) .' new posts'))) ."\n"
+          . t('Recent content - !count', array('!count' => format_plural(count($nodes), '1 new post', '@count new posts'))) ."\n"
           . $separator ."\n\n". $node_body;
       }
     }
@@ -496,7 +513,7 @@ function _notify_send() {
         if ($comment_body) {
           $comment_body .= $mini_separator ."\n\n";
         }
-        $comment_body .= t('!count attached to !type posted by !author: !title', array('!count' => format_plural(count($comment), '1 new comment', '!count new comments'), '!title' => $nodes[$nid]->title, '!type' => node_get_types('name', $nodes[$nid]), '!author' => $nodes[$nid]->name ? $nodes[$nid]->name : variable_get('anonymous', 'Anonymous'))) ."\n";
+        $comment_body .= t('!comment attached to !type posted by !author: !title', array('!comment' => format_plural(count($comment), '1 new comment', '@count new comments'), '!title' => $nodes[$nid]->title, '!type' => node_get_types('name', $nodes[$nid]), '!author' => $nodes[$nid]->name ? $nodes[$nid]->name : variable_get('anonymous', 'Anonymous'))) ."\n";
 
         $comment_count = 0;
         foreach ($comment as $c) {
@@ -508,7 +525,7 @@ function _notify_send() {
 
       if ($total_comment_count > 0) {
         $comment_body = $separator ."\n"
-          . t('Recent comments - !count', array('!count' => format_plural($total_comment_count, '1 new comment', '!count new comments'))) ."\n"
+          . t('Recent comments - !count', array('!count' => format_plural($total_comment_count, '1 new comment', '@count new comments'))) ."\n"
           . $separator ."\n\n". $comment_body;
       }
     }
@@ -560,6 +577,7 @@ function notify_mail($key, &$message, $p
  */
 function _notify_switch_user($uid = NULL) {
   global $user;
+  global $language;
   static $orig_user = array();
 
   if (isset($uid)) {
@@ -568,6 +586,7 @@ function _notify_switch_user($uid = NULL
     // until we are sure we're the invoking user again.
     session_save_session(FALSE);
     $user = user_load(array('uid' => $uid));
+    if(isset($user->language) && $user->language) $language->language = $user->language;
   }
   // Retrieve the initial user, can be called multiple times.
   else if (count($orig_user)) {
