CVS: phpweather/output pw_text_sk.php,1.2,1.3
Brought to you by:
iridium
|
From: Ondrej J. <ne...@us...> - 2002-09-05 01:47:25
|
Update of /cvsroot/phpweather/phpweather/output
In directory usw-pr-cvs1:/tmp/cvs-serv24195
Modified Files:
pw_text_sk.php
Log Message:
Some new sentences/words were translated. There are currently only few
untranslated items.
Weather reporting function print_pretty_weather() and clouds reporting
function print_pretty_clouds() were rewritten to handle much more cases
with proper grammar handling.
Index: pw_text_sk.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/output/pw_text_sk.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- pw_text_sk.php 28 Aug 2002 21:13:40 -0000 1.2
+++ pw_text_sk.php 5 Sep 2002 01:47:18 -0000 1.3
@@ -117,7 +117,7 @@
'SCT' => 'rozptýlené',
'BKN' => 'zatiahnuté',
'OVC' => 'zamraèené');
- $this->strings['cumulonimbus'] = ' cumulonimbus';
+ $this->strings['cumulonimbus'] = ' nahromadené búrkové';
$this->strings['towering_cumulus'] = ' týèiace sa nahromadené';
$this->strings['cavok'] = ' ¾iadne oblaky pod %s a ani ¾iadne iné nahromadené oblaky';
$this->strings['currently'] = 'Aktuálnym poèasím bolo ';
@@ -167,15 +167,15 @@
$this->strings['visibility_to'] = ' do ';
/* this is left untranslated, because I have no metar, that use
* this text -- Nepto [14/07/2002] */
- $this->strings['runway_upward_tendency'] = ' with an %supward%s tendency';
- $this->strings['runway_downward_tendency'] = ' with a %sdownward%s tendency';
- $this->strings['runway_no_tendency'] = ' with %sno distinct%s tendency';
- $this->strings['runway_between'] = 'between ';
+ $this->strings['runway_upward_tendency'] = ' so %sstúpajúcou%s tendenciou';
+ $this->strings['runway_downward_tendency'] = ' s %sklesajúcou%s tendenciou';
+ $this->strings['runway_no_tendency'] = ' s %snejednoznaènou%s tendenciou';
+ $this->strings['runway_between'] = 'medzi ';
$this->strings['runway_left'] = ' left';
$this->strings['runway_central'] = ' central';
$this->strings['runway_right'] = ' right';
$this->strings['runway_visibility'] = 'Viditeµnos» bola ';
- $this->strings['runway_for_runway'] = ' for runway ';
+ $this->strings['runway_for_runway'] = ' pre pristávaciu dráhu èíslo ';
/* We run the parent constructor */
$this->pw_text($weather, $input);
@@ -240,13 +240,33 @@
return parent::print_pretty_wind($wind);
}
+ function print_pretty_clouds($clouds) {
+ for ($i = 0; $i < count($clouds); $i++) {
+ if ($i == 0 && $clouds[$i]['condition'] == 'OVC') {
+ if (1) {
+ $this->strings['cloud_group_beg'] .= ' oblaky, ';
+ } else { // another solution, nicer but incomplete (see TODO below)
+ $this->strings['cloud_group_beg'] = '';
+ $this->strings['cloud_overcast'] =
+ ucfirst(ltrim($this->strings['cloud_overcast']));
+ }
+ }
+ if ($i < count($clouds) - 1) {
+ // TODO: Obloha bola zamracena od vysky XX metrov, ... oblaky.
+ }
+ }
+ return parent::print_pretty_clouds($clouds);
+ }
+
function parse_cloud_group($cloud_group)
{
extract($cloud_group);
- if (isset($condition) && $condition == 'CAVOK') {
- $this->strings['cloud_group_beg'] =
- str_replace(' boli ', ' neboli ', $this->strings['cloud_group_beg']);
+ if (isset($condition)) {
+ if ($condition == 'CAVOK') {
+ $this->strings['cloud_group_beg'] =
+ str_replace(' boli ', ' neboli ', $this->strings['cloud_group_beg']);
+ }
}
return parent::parse_cloud_group($cloud_group);
@@ -273,24 +293,54 @@
}
function print_pretty_weather($weather)
- {
- if ($weather[0]['descriptor'] == 'SH') {
- $this->strings['currently'] = str_replace(' bolo ', ' boli ',
- $this->strings['currently']);
- if ($weather[0]['precipitation'] == 'RA') {
- $this->strings['weather']['-'] = ' riedkeho ';
- $this->strings['weather'][' '] = ' stredného ';
- $this->strings['weather']['+'] = ' hustého ';
- $this->strings['weather']['RA'] = ' da¾ïa';
- }
- } elseif ($weather[0]['precipitation'] == 'RA'
- || $weather[0]['obscuration'] == 'HZ') {
- $this->strings['currently'] = str_replace(' bolo ', ' bol ',
- $this->strings['currently']);
- }
+ {
+ $ret_str = '';
+ for ($k = 0; $k < count($weather); $k++) {
- return parent::print_pretty_weather($weather);
- }
+ if ($weather[$k]['descriptor'] == 'SH') { // prehánky ... da¾ïa
+ $k == 0 && $this->strings['currently'] =
+ str_replace(' bolo ', ' boli ', $this->strings['currently']);
+ if ($weather[$k]['precipitation'] == 'RA') {
+ $this->strings['weather']['-'] = ' riedkeho ';
+ $this->strings['weather'][' '] = ' stredného ';
+ $this->strings['weather']['+'] = ' hustého ';
+ $this->strings['weather']['RA'] = ' da¾ïa';
+ }
+ } elseif ($weather[$k]['descriptor'] == 'TS') { // búrka
+ $k == 0 && $this->strings['currently'] =
+ str_replace(' bolo ', ' bola ', $this->strings['currently']);
+ $this->strings['weather']['-'] = ' riedkym ';
+ $this->strings['weather'][' '] = ' stredným ';
+ $this->strings['weather']['+'] = ' hustým ';
+ $this->strings['weather']['RA'] = ' da¾ïom';
+ $this->strings['with'] = ' a ';
+ } elseif ($weather[$k]['precipitation'] == 'DZ') { // mrholenie
+ $this->strings['weather']['-'] = ' riedke ';
+ $this->strings['weather'][' '] = ' stredné ';
+ $this->strings['weather']['+'] = ' husté ';
+ } elseif ($weather[$k]['precipitation'] == 'RA' // dá¾ï
+ || $weather[$k]['obscuration'] == 'HZ'
+ || $weather[$k]['obscuration'] == 'BR' // hmlový opar
+ ) {
+ $k == 0 && $this->strings['currently'] =
+ str_replace(' bolo ', ' bol ', $this->strings['currently']);
+ } elseif ($weather[$k]['obscuration'] == 'FG') { // ... hmlisto
+ $this->strings['weather']['PR'] = ' èiastoèné';
+ $this->strings['weather']['MI'] = ' plytké';
+ }
+
+ // One part of weather parsing
+ $ret_str .= $this->properties['mark_begin']
+ . $this->parse_weather_group($weather[$k])
+ . $this->properties['mark_end'];
+
+ // Deliminators
+ $k <= count($weather) - 3 && $ret_str .= ',';
+ $k == count($weather) - 2 && $ret_str .= ' a ';
+ }
+
+ return $this->strings['currently'].$ret_str.'.';
+ }
}
/*
|