Index: archive.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/archive/Attic/archive.inc,v
retrieving revision 1.1.2.9
diff -u -r1.1.2.9 archive.inc
--- archive.inc	30 Aug 2007 18:14:22 -0000	1.1.2.9
+++ archive.inc	2 Sep 2007 21:49:28 -0000
@@ -422,7 +422,7 @@
   foreach ($date->years as $year) {
     $all_count += $year;
   }
-  $output .= '<li'. ($date->year?'':' class="selected"') .'>'. l('All', 'archive', array('title' => format_plural($all_count, '1 post', '@count posts'))) ."</li>\n";
+  $output .= '<li'. ($date->year?'':' class="selected"') .'>'. l(t('All'), 'archive', array('title' => format_plural($all_count, '1 post', '@count posts'))) ."</li>\n";
   for ($year = min($all_years); $year <= max($all_years); $year++) {
     $class = '';
     if ($year == $date->year) {
@@ -451,9 +451,10 @@
     $all_count += $month;
   }
   
-  $output .= '<li'. ($date->month?'':' class="selected"') .'>'. l('All', _archive_url($type, $date, $date->year), array('title' => format_plural($all_count, '1 post', '@count posts'))) ."</li>\n";
+  $output .= '<li'. ($date->month?'':' class="selected"') .'>'. l(t('All'), _archive_url($type, $date, $date->year), array('title' => format_plural($all_count, '1 post', '@count posts'))) ."</li>\n";
   $curr_month = date('n', time());
   $curr_year = date('Y', time());
+  $month_names = array('', t('Jan'), t('Feb'), t('Mar'), t('Apr'), t('May'), t('Jun'), t('Jul'), t('Aug'), t('Sep'), t('Oct'), t('Nov'), t('Dec'));
   foreach (range(1, 12) as $month) {
     $posts = !empty($date->months[$month]) ? $date->months[$month] : 0;
     $class = '';
@@ -463,8 +464,7 @@
     elseif ($curr_year == $date->year && $month > $curr_month) {
       $class = ' class="future"';
     }
-    $month_names = array('', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
-    $output .= "<li$class>". ($posts > 0 ? l($month_names[$month], _archive_url($type, $date, 0, $month), array('title' => format_plural($posts, "1 post", "@count posts"))) : $month_names[$month]) ."</li>\n";
+    $output .= "<li$class>". ($posts > 0 ? l($month_names[$month], _archive_url($type, $date, 0, $month), array('title' => format_plural($posts, '1 post', '@count posts'))) : $month_names[$month]) ."</li>\n";
   }
   $output .= "</ul>\n";
   return $output;
@@ -488,7 +488,7 @@
     $all_count += $day;
   }
   
-  $output .= '<li'. ($date->day?'':' class="selected"') .'>'. l('All', _archive_url($type, $date, $date->year, $date->month), array('title' => format_plural($all_count, '1 post', '@count posts'))) ."</li>\n";
+  $output .= '<li'. ($date->day?'':' class="selected"') .'>'. l(t('All'), _archive_url($type, $date, $date->year, $date->month), array('title' => format_plural($all_count, '1 post', '@count posts'))) ."</li>\n";
   $curr_month = date('n', time());
   $curr_year = date('Y', time());
   $curr_day = date('j', time());
@@ -524,7 +524,7 @@
     $all_count += $t['count'];
   }
   
-  $output .= '<li'. ($type != 'all'?'':' class="selected"') .'>'. l('All', _archive_url('all', $date), array('title' => format_plural($all_count, '1 post', '@count posts'))) ."</li>\n";
+  $output .= '<li'. ($type != 'all'?'':' class="selected"') .'>'. l(t('All'), _archive_url('all', $date), array('title' => format_plural($all_count, '1 post', '@count posts'))) ."</li>\n";
   foreach ($types_count as $ft_key => $ft_value) {
     if (!$ft_value['count']) {
       continue;
Index: archive.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/archive/archive.module,v
retrieving revision 1.8.2.5
diff -u -r1.8.2.5 archive.module
--- archive.module	31 Aug 2007 17:16:34 -0000	1.8.2.5
+++ archive.module	2 Sep 2007 21:49:28 -0000
@@ -82,7 +82,7 @@
   $title = $the_date[0] .' '. $the_date[1];
   $year = $the_date[1];
   $month = $the_date[2];
-  $num_days = $the_date[3];
+  $num_days = (int)$the_date[3];
   
   $date = _archive_date('all', $year, $month);
   
@@ -94,21 +94,21 @@
   $rows[] = array(
     array('data' => l($title, _archive_url('all', $date, $year, $month), array('title' => format_plural($date->months[format_date($timestamp, 'custom', 'n')], '1 post', '@count posts'))), 'colspan' => 7, 'style' => 'text-align:center'),
   );
-  $rows[] = array('S', 'M', 'T', 'W', 'T', 'F', 'S');
   
+  // Build the week starting with 
+  $first_day_of_week = variable_get('date_first_day', 0);
+  $week = array(t('Sun'), t('Mon'), t('Tue'), ('Wed'), t('Thu'), t('Fri'), t('Sat'));
+  $day_titles = array();
+  for ($i = $first_day_of_week; $i < $first_day_of_week + 7; $i++) {
+    $day_titles[] = $week[$i%7];
+  }
+  $rows[] = $day_titles;
   // this is inefficient but necessary to determine the start of the month:
   $start = strtotime(format_date($timestamp, 'custom', 'Y-m-01'));
-  $weekday = format_date($start, 'custom', 'w');
+  $weekday = array_search(format_date($start, 'custom', 'D'), $day_titles);
   $days_row = array();
-  for ($j = 0;$j<$weekday;$j++) {
-    $days_row[] = '';
-  }
-  for ($i = -$weekday;$i <= $num_days+$weekday+(7-($num_days+$weekday)%7);$i++) {
+  for ($i = 1-$weekday;$i <= $num_days+$weekday+(7-(($num_days+$weekday)%7))%7;$i++) {
     if ($i > 0) {
-      if (($i+$weekday-1)%7 == 0) {
-        $rows[] = $days_row;
-        $days_row = array();
-      }
       if (array_key_exists($i, $date->days)) {
         $days_row[] = l($i, _archive_url('all', $date, $year, $month, $i), array('title' => format_plural($date->days[$i], '1 post', '@count posts')));
       }
@@ -118,6 +118,15 @@
       else {
         $days_row[] = '';
       }
+      
+      // Add the week table row we just created if we've finished it   
+      if (($i+$weekday)%7 == 0) {
+        $rows[] = $days_row;
+        $days_row = array();
+      }
+    }
+    else {
+      $days_row[] = '';
     }
   }
   return theme('table', array(), $rows);
