Update of /cvsroot/phpweather/phpweather/locales
In directory usw-pr-cvs1:/tmp/cvs-serv24919

Modified Files:
        locale_common.php 
Log Message:
Big changes: all the parts of print_pretty() was responsible for the
different pieces have been moved out of print_pretty() and made into
their own functions. So you can now use print_pretty_time() to get the
string used for the time.

This means that the translators can override these new functions.
Because the code was "hidden" in print_pretty() before, they couldn't
modify it in their locale-file, without copying all the code from
print_pretty().

I've only tested it a little, but it seams to work. But there's
probably some typos hidden somewhere :-)


Index: locale_common.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/locales/locale_common.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- locale_common.php   2001/07/14 19:41:29     1.13
+++ locale_common.php   2001/07/14 21:51:47     1.14
@@ -605,6 +605,336 @@
     return $output;
   }
   
+  function print_pretty_location($location) {
+    return sprintf($this->strings['location'],
+                   $this->properties['mark_begin'],
+                   $location,
+                   $this->properties['mark_end']);
+  }
+  
+  function print_pretty_time($time) {
+    $minutes_old = round((time() - $time)/60);
+    if ($minutes_old > 60) {
+      $hours   = round((time() - $time)/3600);
+      $minutes = $minutes_old % 60;
+      if ($minutes < 1) {
+        $minutes = '';
+      } else {
+        $minutes = sprintf($this->strings['time_minutes'],
+                           $this->properties['mark_begin'],
+                           $minutes,
+                           $this->properties['mark_end']);
+      }
+      if ($hours == 1) {
+        $time_ago = sprintf($this->strings['time_one_hour'],
+                            $this->properties['mark_begin'],
+                            $this->properties['mark_end'],
+                            $minutes);
+      } else {
+        $time_ago = sprintf($this->strings['time_several_hours'],
+                            $this->properties['mark_begin'],
+                            $hours,
+                            $this->properties['mark_end'],
+                            $minutes);
+      }
+    } else {
+      if ($minutes_old < 5) {
+        $time_ago = $this->properties['mark_begin'] .
+          $this->strings['time_a_moment'] . $this->properties['mark_end'];
+      } else {
+        $time_ago = $this->properties['mark_begin'] . $minutes_old .
+          $this->properties['mark_end'] . $this->strings['minutes'];
+      }
+    }
+    $gmtime = gmdate('H:i', $time);
+    
+    return sprintf($this->strings['time_format'],
+                   $time_ago,
+                   $this->properties['mark_begin'],
+                   $gmtime,
+                   $this->properties['mark_end']);
+    
+  }
+
+  
+  function print_pretty_wind($wind) {
+    extract($wind);
+    if (!empty($meters_per_second)) {
+      $wind_str = $this->strings['wind_blowing'] .
+        $this->pref_units($this->properties['mark_begin'] .
+                          $meters_per_second .
+                          $this->properties['mark_end'] . 
+                          $this->strings['meters_per_second'],
+                          $this->properties['mark_begin'] .
+                          $miles_per_hour .
+                          $this->properties['mark_end'] . 
+                          $this->strings['miles_per_hour']);
+      if (!empty($gust_meters_per_second)) {
+        $wind_str .= $this->strings['wind_with_gusts'] .
+          $this->pref_units($this->properties['mark_begin'] .
+                            $gust_meters_per_second .
+                            $this->properties['mark_end'] .
+                            $this->strings['meters_per_second'],
+                            $this->properties['mark_begin'] .
+                            $gust_miles_per_hour .
+                            $this->properties['mark_end'] .
+                            $this->strings['miles_per_hour']);
+      }
+      if ($deg == 'VRB') {
+        $wind_str .= sprintf($this->strings['wind_variable'],
+                             $this->properties['mark_begin'],
+                             $this->properties['mark_end']);
+      } else {
+        
+        $dir_str = $this->strings['wind_dir'][intval(round($deg/22.5))];
+        
+        $wind_str .= $this->strings['wind_from'] .
+          $this->properties['mark_begin'] .
+          $dir_str . $this->properties['mark_end'] . ' (' .
+          $this->properties['mark_begin'] . $deg . '&deg;' .
+          $this->properties['mark_end'] . ')';
+        if (!empty($var_beg)) {
+          
+          $dir_beg_str = $this->strings['wind_dir'][intval(round($var_beg/22.5))];
+          $dir_end_str = $this->strings['wind_dir'][intval(round($var_end/22.5))];
+          
+          $wind_str .= sprintf($this->strings['wind_varying'],
+                               $this->properties['mark_begin'],
+                               $dir_beg_str,
+                               $this->properties['mark_end'],
+                               $this->properties['mark_begin'],
+                               $var_beg,
+                               $this->properties['mark_end'],
+                               $this->properties['mark_begin'],
+                               $dir_end_str,
+                               $this->properties['mark_end'],
+                               $this->properties['mark_begin'],
+                               $var_end,
+                               $this->properties['mark_end']);
+        }
+      }
+    } else {
+      $wind_str = sprintf($this->strings['wind_calm'],
+                          $this->properties['mark_begin'],
+                          $this->properties['mark_end']);
+    }
+    return $wind_str . '.';
+  }
+
+
+  function print_pretty_temperature($temperature) {
+    extract($temperature);
+    $output = $this->strings['temperature'] . 
+      $this->pref_units($this->properties['mark_begin'] . $temp_c .
+                        $this->properties['mark_end'] . ' &deg;C',
+                        $this->properties['mark_begin'] . $temp_f .
+                        $this->properties['mark_end'] . ' &deg;F');
+    if (!empty($dew_c)) {
+      $output .= $this->strings['dew_point'] . 
+        $this->pref_units($this->properties['mark_begin'] . $dew_c .
+                          $this->properties['mark_end'] . ' &deg;C',
+                          $this->properties['mark_begin'] . $dew_f .
+                          $this->properties['mark_end'] . ' &deg;F') . '.';
+    }
+    return $output;
+  }
+
+  function print_pretty_altimeter($altimeter) {
+    extract($altimeter);
+    return $this->strings['altimeter'] . 
+      $this->pref_units($this->properties['mark_begin'] . $hpa .
+                        $this->properties['mark_end'] .
+                        $this->strings['hPa'],
+                        $this->properties['mark_begin'] . $inhg .
+                        $this->properties['mark_end'] .
+                        $this->strings['inHg']) . '.';
+  }
+
+  function print_pretty_rel_humidity($rel_humidity) {
+    return $this->strings['rel_humidity'] .
+      $this->properties['mark_begin'] . $rel_humidity . '%' .
+      $this->properties['mark_end'] . '.';
+  }
+
+
+  function print_pretty_clouds($clouds) {
+    if (empty($clouds[0]) ||
+        $clouds[0]['condition'] == 'CLR' ||
+        $clouds[0]['condition'] == 'SKC') {
+      return sprintf($this->strings['cloud_clear'],
+                     $this->properties['mark_begin'],
+                     $this->properties['mark_end']);
+    } else {
+      
+      $cloud_str1 = $this->parse_cloud_group($clouds[0]);
+      if (!empty($clouds[1])) {
+        $cloud_str2 = $this->parse_cloud_group($clouds[1]);
+      } else {
+        $cloud_str2 = '';
+      }
+      
+      if (!empty($clouds[2])) {
+        $cloud_str3 = $this->parse_cloud_group($clouds[2]);
+      } else {
+        $cloud_str3 = '';
+      }
+      
+      return $this->strings['cloud_group_beg'] .
+        $this->list_sentences($cloud_str1,
+                              $cloud_str2,
+                              $cloud_str3) .
+        $this->strings['cloud_group_end'];
+    }
+  }
+
+
+  function print_pretty_visibility($visibility) {
+
+    $output[0] = $this->parse_visibility_group($visibility[0]);
+    
+    if (!empty($visibility[1])) {
+      $output[1] = $this->parse_visibility_group($visibility[1]);
+    } else {
+      $output[1] = '';
+    }
+    
+    if (!empty($visibility[2])) {
+      $output[2] = $this->parse_visibility_group($visibility[2]);
+    } else {
+      $output[2] = '';
+    }
+    
+    return $this->strings['visibility'] .
+      $this->list_sentences($output[0], $output[1], $output[2]) . '.';
+  }
+
+
+  function print_pretty_precipitation($precipitation) {
+
+    extract($precipitation);
+    
+    $prec_str1 = $this->parse_precip($in, $mm) .
+      $this->strings['precip_last_hour'];
+
+    $prec_str2 = $this->parse_precip($in_6h, $mm_6h) .
+      $this->strings['precip_last_6_hours'];
+
+    $prec_str3 = $this->parse_precip($in_24h, $mm_24h) .
+      $this->strings['precip_last_24_hours'];
+
+    $prec_str4 = $this->parse_precip($snow_in, $snow_mm) .
+      $this->strings['precip_snow'];
+    
+    return $this->strings['precip_there_was'] .
+      $this->list_sentences($prec_str1, $prec_str2, $prec_str3, $prec_str4);
+  }
+
+
+  function print_pretty_temp_min_max($temp_min_max) {
+    
+    extract($temp_min_max);
+    $temp_str = '';
+    if (isset($max6h_c) && isset($min6h_c)) {
+      $temp_str .= $this->strings['temp_min_max_6_hours'] .
+        $this->pref_units($this->properties['mark_begin'] . $temp_max6h_c .
+                          $this->properties['mark_end'] . 
+                          $this->strings['and'] .
+                          $this->properties['mark_begin'] .
+                          $temp_min6h_c .
+                          $this->properties['mark_end'] . ' &deg;C',
+                          $this->properties['mark_begin'] . $temp_max6h_f .
+                          $this->properties['mark_end'] .
+                          $this->strings['and'] .
+                          $this->properties['mark_begin'] .
+                          $temp_min6h_f .
+                          $this->properties['mark_end'] . ' &deg;F') . '.';
+    } else {
+      if (isset($max6h_c)) {
+        if (!empty($temp_str)) {
+          $temp_str .= ' ';
+        }
+        $temp_str .= $this->strings['temp_max_6_hours'] . 
+          $this->pref_units($this->properties['mark_begin'] . $max6h_c .
+                            $this->properties['mark_end'] . ' &deg;C',
+                            $this->properties['mark_begin'] . $max6h_f .
+                            $this->properties['mark_end'] . ' &deg;F') . '.';
+      }
+      if (isset($min6h_c)) {
+        if (!empty($temp_str)) {
+          $temp_str .= ' ';
+        }
+        $temp_str .= $this->strings['temp_min_6_hours'] . 
+          $this->pref_units($this->properties['mark_begin'] . $min6h_c .
+                            $this->properties['mark_end'] . ' &deg;C',
+                            $this->properties['mark_begin'] . $min6h_f .
+                            $this->properties['mark_end'] . ' &deg;F') . '.';
+      }
+    }
+    if (isset($max24h_c)) {
+      if (!empty($temp_str)) {
+        $temp_str .= ' ';
+      }
+      $temp_str .= $this->strings['temp_min_max_24_hours'] .
+        $this->pref_units($this->properties['mark_begin'] . $max24h_c .
+                          $this->properties['mark_end'] .
+                          $this->strings['and'] .
+                          $this->properties['mark_begin'] . $min24h_c .
+                          $this->properties['mark_end'] . ' &deg;C',
+                          $this->properties['mark_begin'] . $max24h_f .
+                          $this->properties['mark_end'] .
+                          $this->strings['and'] .
+                          $this->properties['mark_begin'] . $min24h_f .
+                          $this->properties['mark_end'] . ' &deg;F') . '.';
+    }
+
+    return $temp_str;
+  }
+ 
+  function print_pretty_runway($runway) { 
+    
+    $runway_str1 = $runway_str2 = $runway_str3 = $runway_str4 = '';
+    
+    $runway_str1 = $this->parse_runway_group($runway[0]);
+    if (!empty($runway[1])) {
+      $runway_str2 = $this->parse_runway_group($runway[1]);
+      if (!empty($runway[2])) {
+        $runway_str3 = $this->parse_runway_group($runway[2]);
+        if (!empty($runway[3])) {
+          $runway_str4 = $this->parse_runway_group($runway[3]);
+        }
+      }
+    }
+    
+    return $this->strings['runway_visibility'] .
+      $this->list_sentences($runway_str1,
+                            $runway_str2,
+                            $runway_str3,
+                            $runway_str4) . '.';
+  }
+
+
+  function print_pretty_weather($weather){
+    $weather_str = $this->strings['currently'] .
+      $this->properties['mark_begin'] .
+      $this->parse_weather_group($weather[0]) .
+      $this->properties['mark_end'];
+    if (!empty($weather[1])) {
+      $weather_str = $weather_str . $this->strings['plus'] .
+        $this->properties['mark_begin'] .
+        $this->parse_weather_group($weather[1]) .
+        $this->properties['mark_end'];
+    }
+    if (!empty($weather[2])) {
+      $weather_str = $weather_str . $this->strings['plus'] .
+        $this->properties['mark_begin'] .
+        $this->parse_weather_group($weather[2]) .
+        $this->properties['mark_end'];
+    }
+    
+    return $weather_str . '.';
+  }
+  
+  
   /**
    * The pretty-print function.
    *
@@ -619,8 +949,10 @@
    *          parse_visibility_group(), set_exclude() 
    */
   function print_pretty($data) {
+    
+    extract($data);
     
-    if (empty($data['metar'])) {
+    if (empty($metar)) {
       
       /* We don't want to display all sorts of silly things 
        * if the metar is empty. 
@@ -628,383 +960,103 @@
       
       printf($this->strings['no_data'],
             $this->properties['mark_begin'],
-            $data['location'],
+            $location,
             $this->properties['mark_end']);
       return 1;
     }
     
-    extract($data);
-    
-    /* Location. */
-    
+    /****************
+     *   Location   *
+     ****************/
     if (!in_array('location', $this->properties['exclude'])) {
-      $output['location'] = sprintf($this->strings['location'],
-                                   $this->properties['mark_begin'],
-                                   $location,
-                                   $this->properties['mark_end']);
+      $output['location'] = $this->print_pretty_location($location);
     }
     
     /*********************
      *   Time and date   *
      *********************/
-    
     if (!in_array('time', $this->properties['exclude'])) {
-      $minutes_old = round((time() - $time)/60);
-      if ($minutes_old > 60) {
-       $hours   = round((time() - $time)/3600);
-       $minutes = $minutes_old % 60;
-       if ($minutes < 1) {
-         $minutes = '';
-       } else {
-         $minutes = sprintf($this->strings['time_minutes'],
-                            $this->properties['mark_begin'],
-                            $minutes,
-                            $this->properties['mark_end']);
-       }
-       if ($hours == 1) {
-         $time_ago = sprintf($this->strings['time_one_hour'],
-                             $this->properties['mark_begin'],
-                             $this->properties['mark_end'],
-                             $minutes);
-       } else {
-         $time_ago = sprintf($this->strings['time_several_hours'],
-                             $this->properties['mark_begin'],
-                             $hours,
-                             $this->properties['mark_end'],
-                             $minutes);
-       }
-      } else {
-        if ($minutes_old < 5) {
-         $time_ago = $this->properties['mark_begin'] .
-           $this->strings['time_a_moment'] . $this->properties['mark_end'];
-        } else {
-         $time_ago = $this->properties['mark_begin'] . $minutes_old .
-           $this->properties['mark_end'] . $this->strings['minutes'];
-       }
-      }
-      $gmtime = gmdate('H:i', $time);
-      $output['time'] = sprintf($this->strings['time_format'],
-                               $time_ago,
-                               $this->properties['mark_begin'],
-                               $gmtime,
-                               $this->properties['mark_end']);
+      $output['time'] = $this->print_pretty_time($time);
     }
     
     /*********************
      *   Wind and gust   *
      *********************/
-    
-    if (!in_array('wind', $this->properties['exclude']) && !empty($wind)) {
-      extract($wind);
-      if (!empty($meters_per_second)) {
-       $wind_str = $this->strings['wind_blowing'] .
-         $this->pref_units($this->properties['mark_begin'] .
-                           $meters_per_second .
-                           $this->properties['mark_end'] . 
-                           $this->strings['meters_per_second'],
-                           $this->properties['mark_begin'] .
-                           $miles_per_hour .
-                           $this->properties['mark_end'] . 
-                           $this->strings['miles_per_hour']);
-       if (!empty($gust_meters_per_second)) {
-         $wind_str .= $this->strings['wind_with_gusts'] .
-           $this->pref_units($this->properties['mark_begin'] .
-                             $gust_meters_per_second .
-                             $this->properties['mark_end'] .
-                             $this->strings['meters_per_second'],
-                             $this->properties['mark_begin'] .
-                             $gust_miles_per_hour .
-                             $this->properties['mark_end'] .
-                             $this->strings['miles_per_hour']);
-       }
-       if ($deg == 'VRB') {
-         $wind_str .= sprintf($this->strings['wind_variable'],
-                              $this->properties['mark_begin'],
-                              $this->properties['mark_end']);
-       } else {
-         
-         $dir_str = $this->strings['wind_dir'][intval(round($deg/22.5))];
-         
-         $wind_str .= $this->strings['wind_from'] .
-           $this->properties['mark_begin'] .
-           $dir_str . $this->properties['mark_end'] . ' (' .
-           $this->properties['mark_begin'] . $deg . '&deg;' .
-           $this->properties['mark_end'] . ')';
-         if (!empty($var_beg)) {
-           
-           $dir_beg_str = $this->strings['wind_dir'][intval(round($var_beg/22.5))];
-           $dir_end_str = $this->strings['wind_dir'][intval(round($var_end/22.5))];
-           
-           $wind_str .= sprintf($this->strings['wind_varying'],
-                                $this->properties['mark_begin'],
-                                $dir_beg_str,
-                                $this->properties['mark_end'],
-                                $this->properties['mark_begin'],
-                                $var_beg,
-                                $this->properties['mark_end'],
-                                $this->properties['mark_begin'],
-                                $dir_end_str,
-                                $this->properties['mark_end'],
-                                $this->properties['mark_begin'],
-                                $var_end,
-                                $this->properties['mark_end']);
-         }
-       }
-      } else {
-        $wind_str = sprintf($this->strings['wind_calm'],
-                           $this->properties['mark_begin'],
-                           $this->properties['mark_end']);
-      }
-      $output['wind'] = $wind_str . '.';
+    if (!in_array('wind', $this->properties['exclude']) &&
+        !empty($wind)) {
+      $output['wind'] = $this->print_pretty_wind($wind);
     }
     
     /*********************************
      *   Temperature and dew-point   *
      *********************************/
-    
     if (!in_array('temperature', $this->properties['exclude']) &&
-       !empty($temperature)) {
-      
-      extract($temperature);
-      $output['temperature'] = $this->strings['temperature'] . 
-       $this->pref_units($this->properties['mark_begin'] . $temp_c .
-                         $this->properties['mark_end'] . ' &deg;C',
-                         $this->properties['mark_begin'] . $temp_f .
-                         $this->properties['mark_end'] . ' &deg;F');
-      if (!empty($dew_c)) {
-       $output['temperature'] .= $this->strings['dew_point'] . 
-         $this->pref_units($this->properties['mark_begin'] . $dew_c .
-                           $this->properties['mark_end'] . ' &deg;C',
-                           $this->properties['mark_begin'] . $dew_f .
-                           $this->properties['mark_end'] . ' &deg;F') . '.';
-      }
+        !empty($temperature)) {
+      $output['temperature'] = $this->print_pretty_temperature($temperature);
     }
     
     /****************************
      *   Altimeter (pressure)   *
      ****************************/
-    
     if (!in_array('altimeter', $this->properties['exclude']) &&
        !empty($altimeter)) {
-      extract($altimeter);
-      $output['altimeter'] = $this->strings['altimeter'] . 
-       $this->pref_units($this->properties['mark_begin'] . $hpa .
-                         $this->properties['mark_end'] . ' hPa',
-                         $this->properties['mark_begin'] . $inhg .
-                         $this->properties['mark_end'] . ' inHg') . '.';
+      $output['altimeter'] = $this->print_pretty_altimeter($altimeter);
     }
     
     /**************************
      *   Relative humidity    *
      **************************/
-    
     if (!in_array('rel_humidity', $this->properties['exclude']) &&
        !empty($rel_humidity)) {
-      $output['rel_humidity'] = $this->strings['rel_humidity'] .
-       $this->properties['mark_begin'] . $rel_humidity . '%' .
-       $this->properties['mark_end'] . '.';
+      $output['rel_humidity'] = $this->print_pretty_rel_humidity($rel_humidity);
     }
     
     /*******************
      *   Cloudgroups   *
      *******************/
-    
     if (!in_array('clouds', $this->properties['exclude'])) {
-      if (empty($cloud_group1) ||
-         $cloud_group1['condition'] == 'CLR' ||
-         $cloud_group1['condition'] == 'SKC') {
-       $output['clouds'] = sprintf($this->strings['cloud_clear'],
-                                   $this->properties['mark_begin'],
-                                   $this->properties['mark_end']);
-      } else {
-       
-        $cloud_str1 = $this->parse_cloud_group($cloud_group1);
-        if (!empty($cloud_group2)) {
-         $cloud_str2 = $this->parse_cloud_group($cloud_group2);
-        } else {
-         $cloud_str2 = '';
-       }
-       
-       if (!empty($cloud_group3)) {
-         $cloud_str3 = $this->parse_cloud_group($cloud_group3);
-       } else {
-         $cloud_str3 = '';
-       }
-       
-       $output['clouds'] = $this->strings['cloud_group_beg'] .
-         $this->list_sentences($cloud_str1,
-                               $cloud_str2,
-                               $cloud_str3) .
-         $this->strings['cloud_group_end'];
-      }
+      $output['clouds'] = $this->print_pretty_clouds($clouds);
     }
     
     /******************
      *   Visibility   *
      ******************/
-    
     if (!in_array('visibility', $this->properties['exclude']) &&
-       !empty($visibility_group1)) {
-      
-      $vis_str1 = $this->parse_visibility_group($visibility_group1);
-      
-      if (!empty($visibility_group2)) {
-       $vis_str2 = $this->parse_visibility_group($visibility_group2);
-      } else {
-       $vis_str2 = '';
-      }
-      if (!empty($visibility_group3)) {
-       $vis_str3 = $this->parse_visibility_group($visibility_group3);
-      } else {
-       $vis_str3 = '';
-      }
-      
-      
-      $output['visibility'] = $this->strings['visibility'] .
-       $this->list_sentences($vis_str1, $vis_str2, $vis_str3) . '.';
+       !empty($visibility)) {
+      $output['visibility'] = $this->print_pretty_visibility($visibility);
     }
     
     /*********************
      *   Precipitation   *
      *********************/
-    
     if (!in_array('precip', $this->properties['exclude']) &&
        !empty($precipitation)) {
-      
-      extract($precipitation);
-      
-      $prec_str1 = $this->parse_precip($in, $mm) .
-       $this->strings['precip_last_hour'];
-      $prec_str2 = $this->parse_precip($in_6h, $mm_6h) .
-       $this->strings['precip_last_6_hours'];
-      $prec_str3 = $this->parse_precip($in_24h, $mm_24h) .
-       $this->strings['precip_last_24_hours'];
-      $prec_str4 = $this->parse_precip($snow_in, $snow_mm) .
-       $this->strings['precip_snow'];
-      
-      $output['precip'] = $this->strings['precip_there_was'] .
-       $this->list_sentences($prec_str1, $prec_str2, $prec_str3, $prec_str4);
+      $output['precip'] = $this->print_pretty_precipitation($precipitation);
     }
     
     /********************************
      *   Min and max temperatures   *
      ********************************/
-    
     if (!in_array('temp_min_max', $this->properties['exclude']) &&
        !empty($temp_min_max)) {
-      extract($temp_min_max);
-      $temp_str = '';
-      if (isset($max6h_c) && isset($min6h_c)) {
-       $temp_str .= $this->strings['temp_min_max_6_hours'] .
-         $this->pref_units($this->properties['mark_begin'] . $temp_max6h_c .
-                           $this->properties['mark_end'] . 
-                           $this->strings['and'] .
-                           $this->properties['mark_begin'] .
-                           $temp_min6h_c .
-                           $this->properties['mark_end'] . ' &deg;C',
-                           $this->properties['mark_begin'] . $temp_max6h_f .
-                           $this->properties['mark_end'] .
-                           $this->strings['and'] .
-                           $this->properties['mark_begin'] .
-                           $temp_min6h_f .
-                           $this->properties['mark_end'] . ' &deg;F') . '.';
-      } else {
-       if (isset($max6h_c)) {
-         if (!empty($temp_str)) {
-           $temp_str .= ' ';
-         }
-         $temp_str .= $this->strings['temp_max_6_hours'] . 
-           $this->pref_units($this->properties['mark_begin'] . $max6h_c .
-                             $this->properties['mark_end'] . ' &deg;C',
-                             $this->properties['mark_begin'] . $max6h_f .
-                             $this->properties['mark_end'] . ' &deg;F') . '.';
-       }
-       if (isset($min6h_c)) {
-         if (!empty($temp_str)) {
-           $temp_str .= ' ';
-         }
-         $temp_str .= $this->strings['temp_min_6_hours'] . 
-           $this->pref_units($this->properties['mark_begin'] . $min6h_c .
-                             $this->properties['mark_end'] . ' &deg;C',
-                             $this->properties['mark_begin'] . $min6h_f .
-                             $this->properties['mark_end'] . ' &deg;F') . '.';
-       }
-      }
-      if (isset($max24h_c)) {
-       if (!empty($temp_str)) {
-         $temp_str .= ' ';
-       }
-       $temp_str .= $this->strings['temp_min_max_24_hours'] .
-         $this->pref_units($this->properties['mark_begin'] . $max24h_c .
-                           $this->properties['mark_end'] .
-                           $this->strings['and'] .
-                           $this->properties['mark_begin'] . $min24h_c .
-                           $this->properties['mark_end'] . ' &deg;C',
-                           $this->properties['mark_begin'] . $max24h_f .
-                           $this->properties['mark_end'] .
-                           $this->strings['and'] .
-                           $this->properties['mark_begin'] . $min24h_f .
-                           $this->properties['mark_end'] . ' &deg;F') . '.';
-      }
-      if (!empty($temp_str)) {
-       $output['temp_min_max'] = $temp_str;
-      }
+      $output['temp_min_max'] = $this->print_pretty_temp_min_max($temp_min_max);
     }
     
+    
     /**************************
      *   Runway information   *
      **************************/
-    
     if (!in_array('runway', $this->properties['exclude']) &&
-       !empty($runway_group1)) {
-      
-      $runway_str1 = $runway_str2 = $runway_str3 = $runway_str4 = '';
-      
-      $runway_str1 = $this->parse_runway_group($runway_group1);
-      if (!empty($runway_group2)) {
-       $runway_str2 = $this->parse_runway_group($runway_group2);
-       if (!empty($runway_group3)) {
-         $runway_str3 = $this->parse_runway_group($runway_group3);
-         if (!empty($runway_group4)) {
-           $runway_str4 = $this->parse_runway_group($runway_group4);
-         }
-       }
-      }
-      
-      $output['runway'] = $this->strings['runway_visibility'] .
-       $this->list_sentences($runway_str1,
-                             $runway_str2,
-                             $runway_str3,
-                             $runway_str4) . '.';
+        !empty($runway)) {
+      $output['runway'] = $this->print_pretty_runway($runway);
     }
     
     /***********************
      *   Present weather   *
      ***********************/
-    
     if (!in_array('weather', $this->properties['exclude']) &&
-       !empty($weather_group1)) {
-      
-      $weather_str = $this->strings['currently'] .
-       $this->properties['mark_begin'] .
-       $this->parse_weather_group($weather_group1) .
-       $this->properties['mark_end'];
-      if (!empty($weather_group2)) {
-       $weather_str = $weather_str . $this->strings['plus'] .
-         $this->properties['mark_begin'] .
-         $this->parse_weather_group($weather_group2) .
-         $this->properties['mark_end'];
-      }
-      if (!empty($weather_group3)) {
-       $weather_str = $weather_str . $this->strings['plus'] .
-         $this->properties['mark_begin'] .
-         $this->parse_weather_group($weather_group3) .
-         $this->properties['mark_end'];
-      }
-      
-      if (!empty($weather_str)) {
-       $output['weather'] = $weather_str . '.';
-      }
+       !empty($weather)) {
+      $output['weather'] = $this->print_pretty_weather($weather);
     }
     
     /*


_______________________________________________
PHPWeather-checkins mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/phpweather-checkins

Reply via email to