--- gcal_events.module	2009-02-20 18:33:11.000000000 +0100
+++ gcal_events.module-new	2009-02-28 17:37:00.000000000 +0100
@@ -45,11 +45,11 @@
 define('GCAL_EVENTS_DEFAULT_INPUT_FORMAT', '1');
 define('GCAL_EVENTS_DEFAULT_TODAY_ONLY', '0');
 
-define('GCAL_EVENTS_DEFAULT_HEADING_TODAY', '<b>Today</b><hr />');
-define('GCAL_EVENTS_DEFAULT_HEADING_TOMORROW', '<b>Tomorrow</b><hr />');
-define('GCAL_EVENTS_DEFAULT_HEADING_THISWEEK', '<b>This Week</b><hr />');
-define('GCAL_EVENTS_DEFAULT_HEADING_THISMONTH', '<b>This Month</b><hr />');
-define('GCAL_EVENTS_DEFAULT_HEADING_OTHER', '<b>Other</b><hr />');
+define('GCAL_EVENTS_DEFAULT_HEADING_TODAY', '<b>'.t('Today').'</b><hr />');
+define('GCAL_EVENTS_DEFAULT_HEADING_TOMORROW', '<b>'.t('Tomorrow').'</b><hr />');
+define('GCAL_EVENTS_DEFAULT_HEADING_THISWEEK', '<b>'.t('This Week').'</b><hr />');
+define('GCAL_EVENTS_DEFAULT_HEADING_THISMONTH', '<b>'.t('This Month').'</b><hr />');
+define('GCAL_EVENTS_DEFAULT_HEADING_OTHER', '<b>'.t('Other').'</b><hr />');
 
 if (USE_TIMEZONES) {
   define('GCAL_EVENTS_DEFAULT_TIMEZONE', date_default_timezone_get());
@@ -61,17 +61,17 @@
 function gcal_events_admin() {
   // Only Admin Allowed
   if (!user_access("access administration pages")) {
-    drupal_set_message('You do not have sufficient permissions to access this page', 'error');
+    drupal_set_message(t('You do not have sufficient permissions to access this page'), 'error');
     return;
   }
 
 // Set the number of blocks available for use
   $form['gcal_events_num_blocks'] = array(
     '#type' => 'textfield',
-    '#title' => 'Number of blocks',
+    '#title' => t('Number of blocks'),
     '#size' => 5,
     '#default_value' => variable_get('gcal_events_num_blocks', GCAL_EVENTS_DEFAULT_NUM_BLOCKS),
-    '#description' => 'The number of event blocks to enable',
+    '#description' => t('The number of event blocks to enable'),
     '#required' => TRUE
     );
 
@@ -99,7 +99,7 @@
 
   $form['datetime'] = array(
     '#type' => 'fieldset',
-    '#title' => 'Date/Time',
+    '#title' => t('Date/Time'),
     '#collapsible' => TRUE,
     '#description' => t('The format to display the time/date on the event blocks. The default date format is j F Y, which corresponds to 10 March, 2008. The default time format is g:ia, which corresponds to 12:15am. See the <a href="http://www.php.net/date">PHP Date Reference</A> for details')
     );
@@ -107,7 +107,7 @@
   // Set the date format to be used for display
   $form['datetime']['gcal_events_dateformat'] = array(
     '#type' => 'textfield',
-    '#title' => 'Date Format',
+    '#title' => t('Date Format'),
     '#size' => 10,
     '#default_value' => variable_get('gcal_events_dateformat', GCAL_EVENTS_DEFAULT_DATE_FORMAT),
     '#required' => TRUE
@@ -116,7 +116,7 @@
   // Set the time format to be used for display  
   $form['datetime']['gcal_events_timeformat'] = array(
     '#type' => 'textfield',
-    '#title' => 'Time Format',
+    '#title' => t('Time Format'),
     '#size' => 10,
     '#default_value' => variable_get('gcal_events_timeformat', GCAL_EVENTS_DEFAULT_TIME_FORMAT),
     '#required' => TRUE
@@ -126,17 +126,17 @@
   if (USE_TIMEZONES) {
     $form['datetime']['gcal_events_timezone'] = array(
       '#type' => 'textfield',
-      '#title' => 'Timezone',
+      '#title' => t('Timezone'),
       '#size' => 30,
       '#default_value' => variable_get('gcal_events_timezone', GCAL_EVENTS_DEFAULT_TIMEZONE),
-      '#description' => 'The Timezone to use. See the <a href="http://us.php.net/manual/en/timezones.php">List of Supported Timezones</A>.',
+      '#description' => t('The Timezone to use. See the <a href="http://us.php.net/manual/en/timezones.php">List of Supported Timezones</A>.'),
       '#required' => TRUE
       );
   }
 
   $form['day_grouping'] = array(
     '#type' => 'fieldset',
-    '#title' => 'Day Grouping',
+    '#title' => t('Day Grouping'),
     '#collapsible' => TRUE,
     '#description' => t('This section deals with grouping events by days "Today", "Tomorrow", "This Week", "This Month" and "Other", by default.')
     );
@@ -144,7 +144,7 @@
   // Enable day grouping
   $form['day_grouping']['gcal_events_day_grouping'] = array(
     '#type' => 'checkbox',
-    '#title' => 'Enable Day Grouping',
+    '#title' => t('Enable Day Grouping'),
     '#default_value' => variable_get('gcal_events_day_grouping', FALSE),
     '#description' => t('Enable grouping events by day ("Today", "Tomorrow", "This Week", "This Month" and "Other"')
     );
@@ -197,17 +197,17 @@
   $form['gcal_events_debug'] = array(
     '#type' => 'select',
     '#title' => t('Debug Level'),
-    '#options' => array(0=>"0 - none",1=>"1 - low",2,3,4,5=>"5 - high"),
+    '#options' => array(0=>t("0 - none"),1=>t("1 - low"),2,3,4,5=>t("5 - high")),
     '#default_value' => variable_get('gcal_events_debug', 0),
-    '#description' => 'Enable debugging mode level. Select 0 for no debugging.'
+    '#description' => t('Enable debugging mode level. Select 0 for no debugging.')
     );
 
  // Use templated "Item List"
   $form['gcal_events_item_list'] = array(
     '#type' => 'checkbox',
-    '#title' => 'Item List',
+    '#title' => t('Item List'),
     '#default_value' => variable_get('gcal_events_item_list', GCAL_EVENTS_DEFAULT_ITEM_LIST),
-    '#description' => 'Use unordered list with class gcal_events for event lists. If unchecked, it will just include the exact text as specified in the templates'
+    '#description' => t('Use unordered list with class gcal_events for event lists. If unchecked, it will just include the exact text as specified in the templates')
     );
 
   return system_settings_form($form);
@@ -221,13 +221,13 @@
 
   if (strlen($cache)>0) {
     if (!file_exists($cache)) {
-      form_set_error('gcal_events_cache', t('Cache Directory "') . $cache . t('" does not exist. Please create it before saving the settings.'));
+      form_set_error('gcal_events_cache', t('Cache Directory "@cachedir" does not exist. Please create it before saving the settings.', array("@cachedir"=>$cache)));
     }
     if (!is_dir($cache)) {
-      form_set_error('gcal_events_cache', t('Cache directory "') . $cache . t('" is not a directory!'));
+      form_set_error('gcal_events_cache', t('Cache directory "@cachedir" is not a directory!', array("@cache"=>$cache)));
     }
     if (!is_writeable($cache)) {
-      form_set_error('gcal_events_cache', t('Cache directory "') . $cache . t('" is not writeable'));
+      form_set_error('gcal_events_cache', t('Cache directory "@cachedir" is not writeable', array("@cache"=>$cache)));
     }
   }
 
@@ -251,7 +251,7 @@
   if ($old_num_blocks > $num_blocks)
   {
     for ($a = $num_blocks; $a < $old_num_blocks; $a++) {
-      drupal_set_message("Deleting block ". ($a+1) ." [". variable_get('gcal_events_admin_name_'. $a, 'not named') ."]");
+      drupal_set_message(t("Deleting block @number [@name]", array('@number'=> ($a+1), "@name"=>variable_get('gcal_events_admin_name_'. $a, t('not named')))));
       gcal_events_delete_block($a);
     }
   }
@@ -265,8 +265,8 @@
   $items = array();
 
   $items['admin/settings/gcal_events'] = array(
-    'title' => 'GCal Events module settings',
-    'description' => 'Configure settings for google calendar upcoming event blocks, including the cache directory, number of blocks, and date/time formats',
+    'title' => t('GCal Events module settings'),
+    'description' => t('Configure settings for google calendar upcoming event blocks, including the cache directory, number of blocks, and date/time formats'),
     'page callback' => 'drupal_get_form',
     'page arguments' => array('gcal_events_admin'),
     'access arguments' => array('access administration pages'),
@@ -278,7 +278,7 @@
 
 function gcal_events_admin_name_validate($element) {
 
-  form_set_error('gcal_events_admin_name', 'Admin name not funny enough');
+  form_set_error('gcal_events_admin_name', t('Admin name not funny enough'));
 }
 
 
@@ -313,7 +313,7 @@
       // end users will not see these descriptions.
 
       for ($index=0; $index<variable_get('gcal_events_num_blocks', GCAL_EVENTS_DEFAULT_NUM_BLOCKS); $index++) {
-        $blocks[$index]['info'] = t('GCal Events ['. variable_get('gcal_events_admin_name_'. $index, 'Block '. ($index+1)) .']');
+        $blocks[$index]['info'] = t('GCal Events [@event]', array('@event'=>variable_get('gcal_events_admin_name_'. $index, 'Block '. ($index+1))));
       }
       return $blocks;
 
@@ -382,7 +382,7 @@
 
       $form['datetime'] = array(
         '#type' => 'fieldset',
-	'#title' => 'Date/Time',
+	'#title' => t('Date/Time'),
 	'#collapsible' => TRUE,
 	'#description' => t('The format to display the time/date on the event blocks. Default is j F Y, which corresponds to 10 March, 2008. See the <a href="http://www.php.net/date">PHP Date Reference</A> for details')
 	);
@@ -410,7 +410,7 @@
 
       $form['template']['gcal_events_template_event'] = array(
         '#type' => 'textarea',
-        '#title' => 'Event Template',
+        '#title' => t('Event Template'),
         '#rows' => 5,
         '#cols' => 20,
         '#description' => t('Use the variables #TITLE#, #DESC#, #DATE#, #TIME#, #ENDTIME#, #LOC#, #URL#, to insert values. These values are generated by the templates that follow.'),
@@ -418,39 +418,39 @@
         );
       $form['template']['gcal_events_template_title'] = array(
         '#type' => 'textfield',
-        '#title' => 'Title Template (#TITLE#)',
+        '#title' => t('Title Template (#TITLE#)'),
         '#description' => t('Use #TITLE# to insert the title.'),
         '#default_value' => variable_get('gcal_events_template_title_'. $delta, GCAL_EVENTS_DEFAULT_TEMPLATE_TITLE)
         );
       $form['template']['gcal_events_template_desc'] = array(
         '#type' => 'textfield',
-        '#title' => 'Description Template (#DESC#)',
+        '#title' => t('Description Template (#DESC#)'),
         '#description' => t('Use #DESC# to insert the description.'),
         '#default_value' => variable_get('gcal_events_template_desc_'. $delta, GCAL_EVENTS_DEFAULT_TEMPLATE_DESC)
         );
 
       $form['template']['gcal_events_template_date'] = array(
         '#type' => 'textfield',
-        '#title' => 'Date Template (#DATE#)',
+        '#title' => t('Date Template (#DATE#)'),
         '#description' => t('Use #DATE# to insert the date.'),
         '#default_value' => variable_get('gcal_events_template_date_'. $delta, GCAL_EVENTS_DEFAULT_TEMPLATE_DATE)
         );
       $form['template']['gcal_events_template_time'] = array(
         '#type' => 'textfield',
-        '#title' => 'Time Template (#TIME#)',
+        '#title' => t('Time Template (#TIME#)'),
         '#description' => t('Use #TIME# to insert the time.'),
         '#default_value' => variable_get('gcal_events_template_time_'. $delta, GCAL_EVENTS_DEFAULT_TEMPLATE_TIME)
         );
       $form['template']['gcal_events_template_loc'] = array(
         '#type' => 'textfield',
-        '#title' => 'Location Template (#LOC#)',
+        '#title' => t('Location Template (#LOC#)'),
         '#description' => t('Use #LOC# to insert the location.'),
         '#default_value' => variable_get('gcal_events_template_loc_'. $delta, GCAL_EVENTS_DEFAULT_TEMPLATE_LOC)
         );
 
       $form['text'] = array(
         '#type' => 'fieldset',
-	'#title' => 'Custom Text',
+	'#title' => t('Custom Text'),
 	'#collapsible' => TRUE
 	);
 
@@ -521,7 +521,7 @@
       // If $op is "view", then we need to generate the block for display
       // purposes. The $delta parameter tells us which block is being requested.
 
-      $block['subject'] = t('Calendar '. ($delta+1));
+      $block['subject'] = t('Calendar @number', array("@number"=> ($delta+1)));
       $block['content'] = gcal_events_contents($delta);
 
       return $block;
@@ -575,10 +575,10 @@
   $calendar_ids = variable_get('gcal_events_calendar_id_'. $which_block, '');
   $today_only = variable_get('gcal_events_today_only_'. $which_block, '');
 
-  $admin_name = variable_get('gcal_events_admin_name_' . $which_block, 'Block '. ($which_block+1));
+  $admin_name = variable_get('gcal_events_admin_name_' . $which_block, t('Block @number', array("@number"=>($which_block+1))));
 
   if ($calendar_ids == "") {
-    drupal_set_message('GCal Events['. $admin_name .'] Calendar ID Not Set!', 'error');
+    drupal_set_message(t('GCal Events[@admin_name] Calendar ID Not Set!', array("@admin_name"=>$admin_name)), 'error');
     return;
   }
 
@@ -586,7 +586,7 @@
     gcal_events_debug('Timezone: '. date_default_timezone_get());
     $timezone = variable_get('gcal_events_timezone', GCAL_EVENTS_DEFAULT_TIMEZONE);
     if (!date_default_timezone_set($timezone)) {
-      drupal_set_message('GCal Events: Timezone $timezone is not valid!');
+      drupal_set_message(t('GCal Events: Timezone $timezone is not valid!'));
     }
   }
   else {
@@ -606,14 +606,14 @@
   //Where your simplepie.inc is (mine's in the root for some reason)
   if (!class_exists('SimplePie')) {
     if (!include_once(drupal_get_path('module', 'gcal_events') .'/simplepie.inc')) {
-      drupal_set_message('GCal Events: simplepie.inc not found! Make sure you have simplepie installed and have copied simplepie.inc to the gcal_events directory.', 'error');
+      drupal_set_message(t('GCal Events: simplepie.inc not found! Make sure you have simplepie installed and have copied simplepie.inc to the gcal_events directory.'), 'error');
       return;
     }
   }
 
   // Make sure that correct version of SimplePie is loaded
   if (SIMPLEPIE_VERSION<1) {
-    drupal_set_message('SimplePie v1.0 or above required for GCal Events', 'error');
+    drupal_set_message(t('SimplePie v1.0 or above required for GCal Events'), 'error');
     return;
   }
 
@@ -661,11 +661,11 @@
     if ($cache_location=="") {
       // Cache disabled
       $feed->enable_cache(false);
-      drupal_set_message('GCal Events: WARNING: Cache Disabled');
+      drupal_set_message(t('GCal Events: WARNING: Cache Disabled'));
     }
     else {
       if (!is_writeable($cache_location)) {
-        drupal_set_message('GCal Events: Cache directory not writeable. Caching is disabled.', 'error');
+        drupal_set_message(t('GCal Events: Cache directory not writeable. Caching is disabled.'), 'error');
         $feed->enable_cache(false);
       }
       else {
@@ -693,7 +693,7 @@
     gcal_events_debug_block($admin_name, 'Feed Init took ' . round((microtime(true) - $time_feed_init),2) . ' seconds');
   
     if ($feed->error()) {
-      drupal_set_message('GCal Events ['. $admin_name .'] '. $feed->error(), 'error');
+      drupal_set_message(t('GCal Events [@admin_name] @feed_error', array("@admin_name"=> $admin_name, "@feed_error" =>$feed->error())), 'error');
       return;
     }
   
@@ -743,8 +743,8 @@
       }
 
       if (!$allday) {
-        $gcal_time = date($timeformat, $unixdate);
-	$gcal_endtime = date($timeformat, SimplePie_Misc::parse_date($enddate));
+        $gcal_time = format_date($unixdate, 'custom', $timeformat);
+	$gcal_endtime = format_date(SimplePie_Misc::parse_date($enddate), 'custom', $timeformat);
       }
       else
       {
@@ -759,7 +759,7 @@
         $dateformat = variable_get('gcal_events_dateformat', GCAL_EVENTS_DEFAULT_DATE_FORMAT);
       }
  
-      $gcal_date = date($dateformat, $unixdate);
+      $gcal_date = format_date($unixdate, 'custom', $dateformat);
  
       if (strlen(trim($item->get_title()))>1 && $status != "canceled" && strlen(trim($date)) > 0) {
             $events[] = array(
