Update of /cvsroot/phpweather/phpweather/locales In directory usw-pr-cvs1:/tmp/cvs-serv19560/locales Modified Files: locale_common.php locale_hu.php Log Message: Rearranging comments. Index: locale_common.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/locales/locale_common.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- locale_common.php 2001/07/08 17:36:39 1.8 +++ locale_common.php 2001/07/10 20:56:47 1.9 @@ -7,7 +7,7 @@ } /** - * Provides all the function needed to generate (English) output. + * Provides all the function needed to generate text output. * * This class has the capability to do a pretty-print, if it is * provided with the right set of strings. It's up to child-classes to @@ -19,6 +19,7 @@ * @author Martin Geisler <[EMAIL PROTECTED]> * @version $Id$ */ + class locale_common extends base_object { /** @@ -30,6 +31,7 @@ * * @var array $strings */ + var $strings = array(); /** @@ -40,9 +42,10 @@ * will kick-in. * @access public */ + function locale_common($input) { - /* We call the parent constructor. */ + /* We call the parent constructor. */ $this->base_object($input); } @@ -51,16 +54,17 @@ * Sets the marks (the strings inserted before and after every number) * * @param string The mark used before numbers and other data - * elements, for example '<font color="red">' + * elements, for example '<font color="red">' * * @param string The mark used after numbers and other data * elements, for example '</font>'. If you use HTML tags, it's your - * responsibility to ensure that they match up. If they don't, then your - * pages might not render properly. + * responsibility to ensure that they match up. If they don't, then + * your pages might not render properly. * * @access public * @see get_marks() */ + function set_marks($new_mark_begin, $new_mark_end) { $this->properties['mark_begin'] = $new_mark_begin; $this->properties['mark_end'] = $new_mark_end; @@ -77,6 +81,7 @@ * @access public * @see set_marks() */ + function get_marks() { return array($this->properties['mark_begin'], $this->properties['mark_end']); } @@ -99,6 +104,7 @@ * @access public * @see get_pref_units() */ + function set_pref_units($new_pref_units) { switch ($new_pref_units) { case 'both_metric': @@ -113,7 +119,6 @@ break; } } - /** * Gets the preferred units. @@ -124,11 +129,11 @@ * @access public * @see set_pref_units() */ + function get_pref_units() { return $this->properties['pref_units']; } - /** * Used to specify which elements one wants to exclude from the * pretty-print. @@ -159,7 +164,6 @@ return $this->properties['exclude']; } - /** * Used to format strings with regard to the preferred units. * @@ -170,11 +174,12 @@ * @param string This string should always contain the imperial value. * * @return string The two arguments in the correct order with regard - * to the preferred units. + * to the preferred units. * * @see set_pref_units() * @access private */ + function pref_units($str1, $str2) { switch ($this->properties['pref_units']) { case 'both_metric': @@ -198,7 +203,6 @@ } } - /** * Builds sentences from smaller bits. * @@ -217,6 +221,7 @@ * @access private * @return string The arguments put together. */ + function list_sentences () { $num_args = func_num_args(); @@ -252,7 +257,6 @@ } } - /** * Used to parse precipitation. * @@ -260,7 +264,7 @@ * @param integer The amount of precipitation measured in millimeters. * @access private * @return string A formatted string with information about the - * precipitation. + * precipitation. */ function parse_precip($in, $mm) { @@ -280,15 +284,15 @@ } } - /** * Function used to parse a cloud-group. * * @param array The cloud-group to be parsed. This should be a group - * as parse_metar() would return it. + * as parse_metar() would return it. * @access private * @return string The string used in the pretty-print. */ + function parse_cloud_group($cloud_group) { if (empty($cloud_group) || !is_array($cloud_group)) { return; @@ -321,7 +325,7 @@ } elseif($condition == 'CAVOK') { $output = sprintf($this->strings['cavok'], $this->pref_units($this->properties['mark_begin'] . - '1524' . + '1500' . $this->properties['mark_end'] . $this->strings['meter'], $this->properties['mark_begin'] . @@ -351,7 +355,6 @@ return $output; } - /** * Function used to parse a weather-group. * @@ -359,6 +362,7 @@ * @access private * @return string The string used in the pretty-print. */ + function parse_weather_group($weather_group) { if (empty($weather_group)) { return; @@ -367,18 +371,22 @@ $output = ''; if (!empty($weather_group['descriptor'])) { - /* The descriptor should be filled in */ - if ($weather_group['descriptor'] == 'TS' && + + /* The descriptor should be filled in */ + + if ($weather_group['descriptor'] == 'TS' && !empty($weather_group['precipitation'])) { + /* Special case for thunderstorms. They 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']] . + + $output .= $this->strings['weather'][$weather_group['descriptor']] . $this->strings['with']; } else { - $output .= $this->strings['weather'][$weather_group['descriptor']]; + $output .= $this->strings['weather'][$weather_group['descriptor']]; } } @@ -386,6 +394,7 @@ * 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'])) { @@ -393,6 +402,7 @@ } /* 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'])) { @@ -404,13 +414,13 @@ /* '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']]; } return $output; } - /** * Function used to parse the tendency in a runway-group. * @@ -418,6 +428,7 @@ * @access private * @return string The string used in the pretty-print. */ + function runway_tendency($tendency) { if (empty($tendency)) { return; @@ -446,6 +457,7 @@ * @access private * @return string The string used in the pretty-print. */ + function parse_runway_group($runway_group) { if (empty($runway_group) || !is_array($runway_group)) { return; @@ -513,6 +525,7 @@ * @access private * @return string The string used in the pretty-print. */ + function parse_visibility_group($visibility_group) { if (empty($visibility_group) || !is_array($visibility_group)) { return; @@ -568,27 +581,30 @@ * This is the function responsible for making the weather-report, * also known as the 'pretty-print'. * - * @param array data taken from decode_metar() + * @param array Data taken from decode_metar() * @access public - * @return string The pretty-printed output. + * @return string The pretty-printed output. */ + function print_pretty($data) { if (empty($data['metar'])) { + /* We don't want to display all sorts of silly things * if the metar is empty. */ + printf($this->strings['no_data'], $this->properties['mark_begin'], $data['location'], $this->properties['mark_end']); return 1; } - extract($data); /* Location. */ + if (!in_array('location', $this->properties['exclude'])) { $output['location'] = sprintf($this->strings['location'], $this->properties['mark_begin'], @@ -596,10 +612,10 @@ $this->properties['mark_end']); } - /********************* * Time and date * *********************/ + if (!in_array('time', $this->properties['exclude'])) { $minutes_old = round((time() - $time)/60); if ($minutes_old > 60) { @@ -641,13 +657,13 @@ $this->properties['mark_end']); } - /********************* * Wind and gust * *********************/ + if (!in_array('wind', $this->properties['exclude']) && !empty($wind)) { extract($wind); - if (!empty($meters_per_second)) { + if (!empty($meters_per_second)) { $wind_str = $this->strings['wind_blowing'] . $this->pref_units($this->properties['mark_begin'] . $meters_per_second . @@ -657,7 +673,7 @@ $miles_per_hour . $this->properties['mark_end'] . $this->strings['miles_per_hour']); - if (!empty($gust_meters_per_second)) { + 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'], @@ -704,10 +720,10 @@ $output['wind'] = $wind_str . '.'; } - /********************************* * Temperature and dew-point * *********************************/ + if (!in_array('temperature', $this->properties['exclude']) && !empty($temperature)) { extract($temperature); @@ -724,11 +740,11 @@ $this->properties['mark_end'] . ' °F') . '.'; } } - /**************************** * Altimeter (pressure) * ****************************/ + if (!in_array('altimeter', $this->properties['exclude']) && !empty($altimeter)) { extract($altimeter); $output['altimeter'] = $this->strings['altimeter'] . @@ -738,19 +754,19 @@ $this->properties['mark_end'] . ' inHg') . '.'; } - /************************** * 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'] . '.'; } - /******************* * Cloudgroups * *******************/ + if (!in_array('clouds', $this->properties['exclude'])) { if (empty($cloud_group1) || $cloud_group1['condition'] == 'CLR' || @@ -780,11 +796,11 @@ $this->strings['cloud_group_end']; } } - /****************** * Visibility * ******************/ + if (!in_array('visibility', $this->properties['exclude']) && !empty($visibility_group1)) { $vis_str1 = $this->parse_visibility_group($visibility_group1); @@ -805,10 +821,10 @@ $this->list_sentences($vis_str1, $vis_str2, $vis_str3) . '.'; } - /********************* * Precipitation * *********************/ + if (!in_array('precip', $this->properties['exclude']) && !empty($precipitation)) { extract($precipitation); @@ -826,10 +842,10 @@ $this->list_sentences($prec_str1, $prec_str2, $prec_str3, $prec_str4); } - /******************************** * Min and max temperatures * ********************************/ + if (!in_array('temp_min_max', $this->properties['exclude']) && !empty($temp_min_max)) { extract($temp_min_max); @@ -880,11 +896,11 @@ $output['temp_min_max'] = $temp_str; } } - /************************** * Runway information * **************************/ + if (!in_array('runway', $this->properties['exclude']) && !empty($runway_group1)) { @@ -900,7 +916,6 @@ } } } - $output['runway'] = $this->strings['runway_visibility'] . $this->list_sentences($runway_str1, @@ -908,11 +923,11 @@ $runway_str3, $runway_str4) . '.'; } - /*********************** * Present weather * ***********************/ + if (!in_array('weather', $this->properties['exclude']) && !empty($weather_group1)) { @@ -969,6 +984,7 @@ * @access public * @return string The table with weather-data. */ + function print_table($data) { extract($data); Index: locale_hu.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/locales/locale_hu.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- locale_hu.php 2001/07/10 18:51:37 1.3 +++ locale_hu.php 2001/07/10 20:56:47 1.4 @@ -102,24 +102,24 @@ $this->strings['dew_point'] = ', a harmatpont '; $this->strings['altimeter'] = 'A légköri nyomás '; $this->strings['rel_humidity'] = 'A relatív páratartalom '; - $this->strings['cloud_group_beg'] = 'Az égbolt'; + $this->strings['cloud_group_beg'] = 'Az égbolton'; $this->strings['cloud_group_end'] = ' magasságban.'; $this->strings['cloud_clear'] = 'Az égbolt %sfelhőtlen%s volt.'; - $this->strings['cloud_height'] = ''; + $this->strings['cloud_height'] = ' felhő '; $this->strings['cloud_overcast'] = 'az égbolt %sborult%s '; $this->strings['cloud_vertical_visibility'] = 'a %sfüggőleges láthatóság%s '; $this->strings['cloud_condition'] = array( 'SKC' => ' derült', 'CLR' => ' tiszta', - 'FEW' => ' enyhén felhős ', - 'SCT' => ' szórványosan felhős ', - 'BKN' => ' szakadozottan felhős ', + 'FEW' => ' néhány', + 'SCT' => ' szórványos', + 'BKN' => ' szakadozott', 'OVC' => ' borult'); - $this->strings['cumulonimbus'] = ' gomolyfelhők '; - $this->strings['towering_cumulus'] = ' viharfelhők '; - $this->strings['cavok'] = 'on nincsenek felhők %s magasságban, és nincs gomolyfelhő'; + $this->strings['cumulonimbus'] = ' gomolyfelhő '; + $this->strings['towering_cumulus'] = ' viharfelhő '; + $this->strings['cavok'] = ' nincsenek felhők %s magasságban, és nincs +gomolyfelhő'; $this->strings['currently'] = 'Jellemző: '; $this->strings['weather'] = array( _______________________________________________ PHPWeather-checkins mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/phpweather-checkins