Re: Translation problems
Brought to you by:
iridium
|
From: Martin G. <gim...@gi...> - 2002-05-21 16:54:20
|
Ondrej Jombik <ne...@po...> writes:
> And what about this solution:
There's a couple of problems, look below:
=20
> function print_pretty_wind($wind)
> {
> extract($wind);
>=20
> if (! empty($meters_per_second)) {
> if ($meters_per_second - floor($meters_per_second) > 0) {
> $this->strings['meters_per_second'] =3D ' metra za sekundu';
> }
> elseif ($meters_per_second =3D=3D 1) {
> $this->strings['meters_per_second'] =3D ' meter za sekundu';
> }
The windspeed doesn't have to be a whole number of meters per hour:
it's converted from a whole number of knots into meters/second and
miles/hour so it will not be a whole number after the conversion.
> elseif ($meters_per_second =3D=3D 2
> || $meters_per_second =3D=3D 3
> || $meters_per_second =3D=3D 4) {
> $this->strings['meters_per_second'] =3D ' metre za sekundu';
> }
What if the windspeed is more than 4 meters per second? Don't you miss
that case?
> }
> if (! empty($miles_per_hour)) {
> if ($miles_per_hour =3D=3D 1) {
> $this->strings['miles_per_hour'] =3D ' m=ED=B5a za hodinu';
> }
> elseif ($miles_per_hour =3D=3D 2
> || $miles_per_hour =3D=3D 3
> || $miles_per_hour =3D=3D 4) {
> $this->strings['miles_per_hour'] =3D ' m=EDle za hodinu';
> }
> }
>=20
> return parent::print_pretty_wind($wind);
Ahh - very clever! :-) At first I didn't understand what you were
trying to do, but now I see it - pretty cool. There should probably be
a little comment that explains it to others...=20
=2D-=20
Martin Geisler My GnuPG Key: 0xF7F6B57B
See my homepage at http://www.gimpster.com/ for:
PHP Weather =3D> Shows the current weather on your webpage.
PHP Shell =3D> A telnet-connection (almost :-) in a PHP page.
|