Update of /cvsroot/phpweather/phpweather/locales In directory usw-pr-cvs1:/tmp/cvs-serv14346/locales Modified Files: locale_common.php Added Files: locale_hu.php Log Message: --- NEW FILE --- <?php require_once(PHPWEATHER_BASE_DIR . '/locales/locale_common.php'); /** * Provides all the strings needed by locale_common to produce * Hungarian output. * * @author Mihaly Gyulai http://gyulai.freeyellow.com/ * @version */ class locale_hu extends locale_common { /** * This constructor provides all the strings used. * * @param array This is just passed on to locale_common() */ function locale_hu($input) { $this->strings['charset'] = 'ISO-8859-2'; $this->strings['no_data'] = 'Sajnos nincs adat %s%s%s számára.'; $this->strings['list_sentences_and'] = ' és '; $this->strings['list_sentences_comma'] = ', '; $this->strings['list_sentences_final_and'] = ', és '; $this->strings['location'] = 'Időjárásjelentés %s%s%s számára.'; $this->strings['minutes'] = ' '; $this->strings['time_format'] = 'A jelentés %s perccel ezelőtt készült, %s%s%s UTC-kor.'; $this->strings['time_minutes'] = 'és %s%s%s '; $this->strings['time_one_hour'] = '%segy%s órával %s'; $this->strings['time_several_hours'] = '%s%s%s órával %s'; $this->strings['time_a_moment'] = 'jelenleg'; $this->strings['meters_per_second'] = ' m/s'; $this->strings['miles_per_hour'] = ' mérföld/h'; $this->strings['meter'] = ' m'; $this->strings['meters'] = ' m'; $this->strings['feet'] = ' láb'; $this->strings['kilometers'] = ' km'; $this->strings['miles'] = ' mérföld'; $this->strings['and'] = ' és '; $this->strings['plus'] = ' és '; $this->strings['with'] = ' with? '; $this->strings['wind_blowing'] = 'Szélsebesség: '; $this->strings['wind_with_gusts'] = ' széllökések: '; $this->strings['wind_from'] = ' iránya: '; $this->strings['wind_variable'] = ' %skülönböző%s irányokból.'; $this->strings['wind_varying'] = ', változik %s%s%s (%s%s°%s) és %s%s%s (%s%s°%s) között'; $this->strings['wind_calm'] = 'Szél %snem fújt%s'; $this->strings['wind_dir'] = array( 'Észak', 'Észak/Északkelet', 'Északkelet', 'Kelet/Északkelet', 'Kelet', 'Kelet/Délkelet', 'Délkelet', 'Dél/Délkelet', 'Dél', 'Dél/Délnyugat', 'Délnyugat', 'Nyugat/Délnyugat', 'Nyugat', 'Nyugat/Északnyugat', 'Északnyugat', 'Észak/Északnyugat', 'Észak'); $this->strings['wind_dir_short'] = array( 'É', 'É/ÉK', 'ÉK', 'K/ÉK', 'K', 'K/DK', 'DK', 'D/DK', 'D', 'D/DNY', 'DNY', 'NY/DNY', 'NY', 'NY/ÉNY', 'ÉNY', 'É/ÉNY', 'É' ); $this->strings['wind_dir_short_long'] = array( 'É' => 'északi', 'ÉK' => 'északkeleti', 'K' => 'keleti', 'DK' => 'délkeleti', 'D' => 'déli', 'DNY' => 'délnyugati', 'NY' => 'nyugati', 'ÉNY' => 'északnyugati' ); $this->strings['temperature'] = 'A hőmérséklet '; $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'] = ''; $this->strings['cloud_group_end'] = '.'; $this->strings['cloud_clear'] = 'Az égbolt %sfelhőtlen%s volt.'; $this->strings['cloud_height'] = ' felhők '; $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' => 'gyenge', 'SCT' => 'szórványos', 'BKN' => 'szakadozott', 'OVC' => 'borult'); $this->strings['cumulonimbus'] = ' gomolyfelhős'; $this->strings['towering_cumulus'] = ' viharfelhős'; $this->strings['cavok'] = ' Nincsenek felhők %s magasságban, és nincs gomolyfelhő'; $this->strings['currently'] = 'Jellemző: '; $this->strings['weather'] = array( '-' => 'könnyű ', ' ' => 'enyhe ', '+' => 'erős ', 'VC' => ' közeli', 'PR' => ' részleges', 'BC' => ' szakadozott', 'MI' => ' felszínes', 'DR' => 'enyhe légmozgás', 'BL' => 'széllökés', 'SH' => 'zápor', 'TS' => 'zivatar', 'FZ' => 'fagy', 'DZ' => 'szitáló eső', 'RA' => 'eső', 'SN' => 'hó', 'SG' => 'szemcsés hó', 'IC' => 'jégkristály', 'PE' => 'jégdara', 'GR' => 'jégeső', 'GS' => 'apró jégeső és/vagy hódara', 'UP' => 'ismeretlen', 'BR' => 'köd', 'FG' => 'sűrű köd', 'FU' => 'füst', 'VA' => 'vulkáni hamu', 'DU' => 'kiterjedt por', 'SA' => 'homok', 'HZ' => 'pára', 'PY' => 'permet', 'PO' => 'por/homok örvény', 'SQ' => 'szélroham', 'FC' => 'felhőtölcsér/tornádó/vízoszlop', 'SS' => 'homokvihar/porvihar' ); $this->strings['visibility'] = 'A láthatóság általában '; $this->strings['visibility_greater_than'] = 'nagyobb, mint '; $this->strings['visibility_less_than'] = 'kisebb, mint '; $this->strings['runway_upward_tendency'] = ' %snövekvő%s tendenciával'; $this->strings['runway_downward_tendency'] = ' %scsökkenő%s tendenciával'; $this->strings['runway_no_tendency'] = ' határozott %stendencia nélkül%s'; $this->strings['runway_between'] = 'közötti? '; $this->strings['runway_left'] = ' bal'; $this->strings['runway_central'] = ' középső'; $this->strings['runway_right'] = ' jobb'; $this->strings['runway_visibility'] = 'A láthatóság '; $this->strings['runway_for_runway'] = ' a kifutópályán '; /* We run the parent constructor */ $this->locale_common($input); } } ?> Index: locale_common.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/locales/locale_common.php,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- locale_common.php 2001/07/05 19:02:50 1.6 +++ locale_common.php 2001/07/08 17:09:24 1.7 @@ -9,7 +9,12 @@ /** * Provides all the function needed to generate (English) 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 provide these strings, and override the methods in this class, as necessary. The logic in the pretty-print is built around the English output, but it should still be possible to make a good translation, by just translating the strings. + * 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 + * provide these strings, and override the methods in this class, as + * necessary. The logic in the pretty-print is built around the English + * output, but it should still be possible to make a good translation, by + * just translating the strings. * * @author Martin Geisler <[EMAIL PROTECTED]> * @version $Id$ @@ -17,9 +22,11 @@ class locale_common extends base_object { /** - * The strings used in the translation is stored here. + * The strings used in the translation are stored here. * - * Each string is identified by it's key in the array. Some strings are used between the dynamic parts, and others are used as format-strings to sprintf(). + * Each string is identified by its key in the array. Some strings + * are used between the dynamic parts, and others are used as + * format-strings to sprintf(). * * @var array $strings */ @@ -28,20 +35,28 @@ /** * Constructor. * - * @param array The initial properties of the object. If you omit some properties, the defaults will kick-in. + * @param array The initial properties of the object. + * If you omit some properties, the defaults will kick-in. * @access public */ function locale_common($input) { - /* We call the parent constructor. */ - $this->base_object($input); - + + /* We call the parent constructor. */ + + $this->base_object($input); } /** * 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">' + * + * @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. * - * @param string The mark used before numbers and other data 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 you pages might not render properly. * @access public * @see get_marks() */ @@ -51,9 +66,13 @@ } /** - * Gets the marks + * Gets the marks. * - * @return array The first element is the string is inserted before any number, and the second element is the string inserted after. The first element is also know as 'mark_begin' and the second as 'mark_end'. + * @return array The first element is the string that's inserted + * before any number, and the second element is the string inserted + * after. The first element is also known as 'mark_begin' and the + * second as 'mark_end'. + * * @access public * @see set_marks() */ @@ -65,13 +84,17 @@ * Specifies which kind of units to display. * * $new_pref_units can be one of the following strings: - * - 'both_metric' if one wants to produce output like this '10 kilometers (16.1 miles)' - * - 'both_imperial' if one wants to produce output like this '16.1 miles (10 kilometers)' - * - 'only_metric' if one wants to produce output like this '10 kilometers' - * - 'only_imperial' if one wants to produce output like this '16.1 miles' - * If $new_pref_units isn't recognized, 'both_imperial' will be used instead. + * - 'both_metric' if one wants to produce output like this: + * '10 kilometers (16.1 miles)' + * - 'both_imperial' if one wants to produce output like this: + * '16.1 miles (10 kilometers)' + * - 'only_metric' if one wants to produce output like this: + * '10 kilometers' + * - 'only_imperial' if one wants to produce output like this: + * '16.1 miles' + * If $new_pref_units isn't recognized, 'both_imperial' will be used. * - * @param string The new kind of units one wants to use. + * @param string The new kind of units one wants to use. * @access public * @see get_pref_units() */ @@ -93,8 +116,10 @@ /** * Gets the preferred units. + * + * @return string The preferred kind of units. This will be one of + * 'both_metric', 'both_imperial', 'only_metric' or 'only_imperial'. * - * @return string The preferred kind of units. This will be one of 'both_metric', 'both_imperial', 'only_metric' or 'only_imperial'. * @access public * @see set_pref_units() */ @@ -104,9 +129,13 @@ /** - * Used to specify which elements one wants to exclude from the pretty-print. + * Used to specify which elements one wants to exclude from the + * pretty-print. + * + * @param array The array should contain the names of the sections + * one doesn't want to be displayed, like 'wind' or 'time' if one wants + * to skip the wind or time parts of the pretty-print. * - * @param array The array should contain the names of the sections one doesn't want to have displayed, like 'wind' or 'time' if one wants to skip the wind or time parts of the pretty-print. * @access public * @see get_exclude() */ @@ -132,12 +161,16 @@ /** * Used to format strings with regard to the preferred units. + * + * If 'pref_units' isn't recognized, the function will set it to + * 'both_imperial', and try again. + * + * @param string This string should always contain the metric value. + * @param string This string should always contain the imperial value. * - * If 'pref_units' isn't recognized, the function will set it to 'both_imperial', and try again. + * @return string The two arguments in the correct order with regard + * to the preferred units. * - * @param string This string should always contain the metric value. - * @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. * @see set_pref_units() * @access private */ @@ -168,14 +201,20 @@ /** * Builds sentences from smaller bits. * - * Takes an arbitrary number of strings as its arguments, and returns them with commas between. The strings used between the arguments, are controlled by these variables: + * Takes an arbitrary number of strings as its arguments, and + * returns them with commas between. The strings used between the + * arguments are controlled by these variables: + * * - $strings['list_sentences_and'] * - $strings['list_sentences_comma'] * - $strings['list_sentences_final_and'] - * Only non-empty arguments are used, so it's safe to call this function with empty strings. But if you try to call it with uninitialized variables, then PHP might warn you about it anyway. + * + * Only non-empty arguments are used, so it's safe to call this + * function with empty strings. But if you try to call it with + * uninitialized variables, then PHP might warn you about it anyway. * * @access private - * @return string The arguments put together. + * @return string The arguments put together. */ function list_sentences () { $num_args = func_num_args(); @@ -216,11 +255,13 @@ /** * Used to parse precipitation. * - * @param integer The amount of precipitation measured in inches. - * @param integer The amount of precipitation measured in millimeters. + * @param integer The amount of precipitation measured in inches. + * @param integer The amount of precipitation measured in millimeters. * @access private - * @return string A formatted string with information about the precipitation. + * @return string A formatted string with information about the + * precipitation. */ + function parse_precip($in, $mm) { if (!empty($in)) { @@ -242,9 +283,10 @@ /** * 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. - * @return string the string used in the pretty-print. + * @param array The cloud-group to be parsed. This should be a group + * 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)) { @@ -309,13 +351,12 @@ } - /** * Function used to parse a weather-group. * - * @param array the weather-group to be parsed. - * @return string the string used in the pretty-print. + * @param array The weather-group to be parsed. * @access private + * @return string The string used in the pretty-print. */ function parse_weather_group($weather_group) { if (empty($weather_group)) { @@ -325,13 +366,14 @@ $output = ''; if (!empty($weather_group['descriptor'])) { - /* The descriptor should be filled in */ + /* 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. */ + /* 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']] . $this->strings['with']; } else { @@ -339,54 +381,41 @@ } } - - /* 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 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'])) { $output .= $this->strings['weather'][' ']; } - /* There can only be one of the next three items. */ + /* There can only be one of the next three items. */ if (!empty($weather_group['precipitation'])) { - /* There can be up to three types of precipitation... */ - $precip_str1 = $this->strings['weather'][substr($weather_group['precipitation'], 0, 2)]; - if (strlen($weather_group['precipitation']) > 2) { - $precip_str2 = $this->strings['weather'][substr($weather_group['precipitation'], 2, 2)]; - } else { - $precip_str2 = ''; - $precip_str3 = ''; - } - if (strlen($weather_group['precipitation']) > 4) { - $precip_str3 = $this->strings['weather'][substr($weather_group['precipitation'], 4, 2)]; - } else { - $precip_str3 = ''; - } - $output .= $this->list_sentences($precip_str1, $precip_str2, $precip_str3); + $output .= $this->strings['weather'][$weather_group['precipitation']]; } elseif (!empty($weather_group['obscuration'])) { $output .= $this->strings['weather'][$weather_group['obscuration']]; } 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. */ + /* '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; + return $output; } /** * Function used to parse the tendency in a runway-group. * - * @param string the tendency - * @return string the string used in the pretty-print. + * @param string The tendency * @access private + * @return string The string used in the pretty-print. */ function runway_tendency($tendency) { if (empty($tendency)) { @@ -412,9 +441,9 @@ /** * Function used to parse a runway-group. * - * @param array the runway-group to be parsed. - * @return string the string used in the pretty-print. + * @param array The runway-group to be parsed. * @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)) { @@ -475,16 +504,13 @@ } return $output; } - - - /** * Function used to parse a visibility-group. * - * @param array the visibility-group to be parsed. - * @return string the string used in the pretty-print. + * @param array The visibility-group to be parsed. * @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)) { @@ -535,22 +561,22 @@ return $output; } - - /** * The pretty-print function. * - * This is the function responsible for making the weather-report, also know as the 'pretty-print'. + * This is the function responsible for making the weather-report, + * also known as the 'pretty-print'. * * @param array data taken from decode_metar() - * @return string The pretty-printed output. * @access public + * @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. */ + /* 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'], @@ -561,7 +587,7 @@ extract($data); - /* Location. */ + /* Location. */ if (!in_array('location', $this->properties['exclude'])) { $output['location'] = sprintf($this->strings['location'], $this->properties['mark_begin'], @@ -570,9 +596,9 @@ } - /********************* - * Time and date * - *********************/ + /********************* + * Time and date * + *********************/ if (!in_array('time', $this->properties['exclude'])) { $minutes_old = round((time() - $time)/60); if ($minutes_old > 60) { @@ -712,7 +738,6 @@ } - /************************** * Relative humidity * **************************/ @@ -722,7 +747,6 @@ } - /******************* * Cloudgroups * *******************/ @@ -914,7 +938,7 @@ } /* - * This is where we make the output. + * This is where we make the HTML output. */ echo '<!-- Generated by PHP Weather ' . $this->version . " -->\n"; @@ -940,9 +964,9 @@ /** * Makes a short weather-report in a table. * - * @param array data taken from decode_metar() - * @return string The table with weather-data. + * @param array Data taken from decode_metar() * @access public + * @return string The table with weather-data. */ function print_table($data) { @@ -957,8 +981,7 @@ $pressure = $this->pref_units($altimeter['hpa'] . ' hPa', $altimeter['inhg'] . ' inHg'); - /* The table-heading ought to be - translated. */ + /* The table-heading ought to be translated. */ echo "<table> <tr> _______________________________________________ PHPWeather-checkins mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/phpweather-checkins