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

Modified Files:
        locale_common.php locale_da.php locale_en.php 
Log Message:
I've removed the call to require_once() since it's only PHP4 that
understands it. Instead of relying on PHP to manage the required
files, each file now start by defining a constant, so that the page
knows if it's loaded twice.


Index: locale_common.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/locales/locale_common.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- locale_common.php   2001/07/01 18:20:43     1.4
+++ locale_common.php   2001/07/05 16:00:09     1.5
@@ -1,4 +1,11 @@
 <?php
+/* This code makes sure that the file is only included once. */
+if (defined('LOCALE_COMMON')) {
+  return;
+} else {
+  define('LOCALE_COMMON', true);
+}
+
 /**
  * Provides all the function needed to generate (English) output.
  *
@@ -318,8 +325,13 @@
     $output = '';
 
     if (!empty($weather_group['descriptor'])) {
+      /* The descriptor should be filled in */
       if ($weather_group['descriptor'] == 'TS' &&
          !empty($weather_group['precipitation'])) {
+       /* Special case for thunderstorms. They have use the extra
+           word 'with' between the descriptor (which would be
+           'thunderstorm' in this case) and the precipitation. But
+           this is only true if there's also precipitation. */
        $output .= $this->strings['weather'][$weather_group['descriptor']] .
          $this->strings['with'];
       } else {
@@ -327,12 +339,17 @@
       }
     }
 
+
+    /* If the intensity is non-empty we just add it. If not, it could
+       mean that we're dealing with some 'moderate' precipitation. If
+       so, 'precipitation' can't be empty. */
     if (!empty($weather_group['intensity'])) {
       $output .= $this->strings['weather'][$weather_group['intensity']];
     } elseif (!empty($weather_group['precipitation'])) {
-      /* We should only use 'moderate' intensity for precipitation. */
       $output .= $this->strings['weather'][' '];
     }
+
+    /* There can only be one of the next three items. */
     if (!empty($weather_group['precipitation'])) {
       $output .= $this->strings['weather'][$weather_group['precipitation']];
     } elseif (!empty($weather_group['obscuration'])) {
@@ -340,6 +357,9 @@
     } elseif (!empty($weather_group['other'])) {
       $output .= $this->strings['weather'][$weather_group['other']];
     }
+
+    /* 'proximity' can only be 'VC'. We test for it here instead of
+       earlier because it should be put last. */
     if (!empty($weather_group['proximity'])) {
       $output .= $this->strings['weather'][$weather_group['proximity']];
     }

Index: locale_da.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/locales/locale_da.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- locale_da.php       2001/07/01 18:20:43     1.2
+++ locale_da.php       2001/07/05 16:00:09     1.3
@@ -1,5 +1,12 @@
 <?php
-require_once(PHPWEATHER_BASE_DIR . '/locales/locale_common.php');
+/* This code makes sure that the file is only included once. */
+if (defined('LOCALE_DA')) {
+  return;
+} else {
+  define('LOCALE_DA', true);
+}
+
+require(PHPWEATHER_BASE_DIR . '/locales/locale_common.php');
 
 /**
  * Provides all the strings needed by locale_common to produce Danish output.

Index: locale_en.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/locales/locale_en.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- locale_en.php       2001/07/01 18:20:43     1.4
+++ locale_en.php       2001/07/05 16:00:09     1.5
@@ -1,5 +1,12 @@
 <?php
-require_once(PHPWEATHER_BASE_DIR . '/locales/locale_common.php');
+/* This code makes sure that the file is only included once. */
+if (defined('LOCALE_EN')) {
+  return;
+} else {
+  define('LOCALE_EN', true);
+}
+
+require(PHPWEATHER_BASE_DIR . '/locales/locale_common.php');
 
 /**
  * Provides all the strings needed by locale_common to produce English output.


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

Reply via email to